package com.xindaoapp.happypet.protocol;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import android.content.Context;
import android.text.TextUtils;
import android.util.Pair;
import android.widget.Toast;

import com.alibaba.fastjson.JSON;
import com.loopj.android.http.AsyncHttpResponseHandler;
import com.loopj.android.http.RequestParams;
import com.xindaoapp.happypet.XDHttpClient;
import com.xindaoapp.happypet.api.AddClient;
import com.xindaoapp.happypet.bean.AddressDetailInfo;
import com.xindaoapp.happypet.bean.AddressInfo;
import com.xindaoapp.happypet.bean.Banzhu;
import com.xindaoapp.happypet.bean.BaseEntity;
import com.xindaoapp.happypet.bean.BrandBean;
import com.xindaoapp.happypet.bean.ConsigneeInfo;
import com.xindaoapp.happypet.bean.DaShangRecord;
import com.xindaoapp.happypet.bean.DaShangRest;
import com.xindaoapp.happypet.bean.Dayens;
import com.xindaoapp.happypet.bean.DianZanListData;
import com.xindaoapp.happypet.bean.ExchangeResult;
import com.xindaoapp.happypet.bean.Fans;
import com.xindaoapp.happypet.bean.ForumInfo;
import com.xindaoapp.happypet.bean.FreeUseListData;
import com.xindaoapp.happypet.bean.GoodsListInfo;
import com.xindaoapp.happypet.bean.GoodsRecord;
import com.xindaoapp.happypet.bean.GroupInfo;
import com.xindaoapp.happypet.bean.Groups;
import com.xindaoapp.happypet.bean.HasNew;
import com.xindaoapp.happypet.bean.HomeBanner;
import com.xindaoapp.happypet.bean.HomeBannerEntity;
import com.xindaoapp.happypet.bean.InformMessage;
import com.xindaoapp.happypet.bean.InteralBanner;
import com.xindaoapp.happypet.bean.InteralGoodsdesc;
import com.xindaoapp.happypet.bean.InteralList;
import com.xindaoapp.happypet.bean.InviteInfo;
import com.xindaoapp.happypet.bean.MainDatas;
import com.xindaoapp.happypet.bean.MainZuixinData;
import com.xindaoapp.happypet.bean.Message;
import com.xindaoapp.happypet.bean.MessageCenterInfo;
import com.xindaoapp.happypet.bean.MessageInfo;
import com.xindaoapp.happypet.bean.MyInformMessage;
import com.xindaoapp.happypet.bean.MyMessageInfo;
import com.xindaoapp.happypet.bean.MyRequestFriend;
import com.xindaoapp.happypet.bean.MyTasklist;
import com.xindaoapp.happypet.bean.NearByInfo;
import com.xindaoapp.happypet.bean.NearPictureBean;
import com.xindaoapp.happypet.bean.NiuniuRecord;
import com.xindaoapp.happypet.bean.PetInfo;
import com.xindaoapp.happypet.bean.Post;
import com.xindaoapp.happypet.bean.PostImgData;
import com.xindaoapp.happypet.bean.PostLandlordInfos;
import com.xindaoapp.happypet.bean.PostLayerInfos;
import com.xindaoapp.happypet.bean.PostListEntity;
import com.xindaoapp.happypet.bean.PostListEntity2;
import com.xindaoapp.happypet.bean.PrivateMessageInfo;
import com.xindaoapp.happypet.bean.Product;
import com.xindaoapp.happypet.bean.QiandaoRecord;
import com.xindaoapp.happypet.bean.ReYiListData;
import com.xindaoapp.happypet.bean.RecommendCicleData;
import com.xindaoapp.happypet.bean.RecommendInfo;
import com.xindaoapp.happypet.bean.ReplyInfo;
import com.xindaoapp.happypet.bean.SecondClass;
import com.xindaoapp.happypet.bean.SendPrivateLetterReturnResult;
import com.xindaoapp.happypet.bean.ShareRecordInfo;
import com.xindaoapp.happypet.bean.ShareToWeibaResult;
import com.xindaoapp.happypet.bean.ShoppingCartInfo;
import com.xindaoapp.happypet.bean.SplashPictureBean;
import com.xindaoapp.happypet.bean.TagInfos;
import com.xindaoapp.happypet.bean.UpdateInfo;
import com.xindaoapp.happypet.bean.User;
import com.xindaoapp.happypet.bean.ZanListData;
import com.xindaoapp.happypet.entry.CommentInfos;
import com.xindaoapp.happypet.entry.GoodsInfos;
import com.xindaoapp.happypet.entry.MyLocation.Locations;
import com.xindaoapp.happypet.entry.MyReplyInfos;
import com.xindaoapp.happypet.entry.OrderInfo;
import com.xindaoapp.happypet.entry.PostCommentInfos;
import com.xindaoapp.happypet.utils.CommonParameter.UserState;
import com.xindaoapp.happypet.utils.CommonUtil;
import com.xindaoapp.happypet.utils.IRequest;
import com.xindaoapp.happypet.utils.KeyValuePair;
import com.xindaoapp.happypet.utils.MoccaPreferences;
import com.xindaoapp.happypet.utils.xdConfig;

public class MoccaApiImpl implements MoccaApi {


    @Override
    public void checkUpdate(final String VersionCode, final IRequest<UpdateInfo> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_VERSION, String.valueOf(VersionCode));
        params.add(PARAM_CLIENTTYPE, "apk");
        params.add(PARAM_APPID, "1");
        XDHttpClient.get2(CHECKUPDATE, params, new AsyncHttpResponseHandler() {

            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                try {
                    UpdateInfo info =
                            JSON.parseObject(new JSONObject(content).getJSONObject("apk")
                                    .toString(), UpdateInfo.class);
                    iRequest.request(info);
                } catch (JSONException e) {
                    e.printStackTrace();
                    iRequest.request(null);
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });
    }

    @Override
    public void getShoppingCart(String userId, final IRequest<ArrayList<ShoppingCartInfo>> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_USERID, CommonUtil.decode(userId));
        params.add(PARAM_VERSION, VERSION);
        XDHttpClient.post2(SHOPBASEURL, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                try {
                    ArrayList<ShoppingCartInfo> shoppingCartInfos =
                            new ArrayList<ShoppingCartInfo>();
                    shoppingCartInfos.addAll(JSON.parseArray(JSON.parseObject(content)
                            .getJSONArray(DATA).toJSONString(), ShoppingCartInfo.class));
                    iRequest.request(shoppingCartInfos);
                } catch (Exception e) {
                    e.printStackTrace();
                    iRequest.request(new ArrayList<ShoppingCartInfo>());
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });
    }

    @Override
    public void getConsigneeCart(IRequest<List<ConsigneeInfo>> iRequest) {

    }

    @Override
    public void deleteShoppingCart(String userId, String recID, final IRequest<Boolean> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_USERID, CommonUtil.decode(userId));
        params.add(PARAM_RECID, CommonUtil.decode(recID));
        params.add(PARAM_VERSION, VERSION);
        XDHttpClient.post2("http://ts.leepet.com/plugins/API.v1.0/?&a=order&m=delCart", params,
                new AsyncHttpResponseHandler() {

                    @Override
                    public void onSuccess(int statusCode, String content) {
                        super.onSuccess(statusCode, content);
                        try {
                            iRequest.request(JSON.parseObject(content).getInteger("status") == 1 ? true
                                    : false);
                        } catch (Exception e) {
                            e.printStackTrace();
                            iRequest.request(false);
                        }
                    }

                    @Override
                    public void onFailure(Throwable error, String content) {
                        super.onFailure(error, content);
                        iRequest.request(false);
                    }
                });
    }

    @Override
    public void editCart(String userID, int goodsNumber, String recID,
            final IRequest<Pair<Boolean, String>> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_USERID, CommonUtil.decode(String.valueOf(userID)));
        params.add(PARAM_GOODSNUMBER, CommonUtil.decode(String.valueOf(goodsNumber)));
        params.add(PARAM_RECID, CommonUtil.decode(recID));
        params.add(PARAM_VERSION, VERSION);
        XDHttpClient.post2("http://ts.leepet.com/plugins/API.v1.0/?&a=order&m=editCart", params,
                new AsyncHttpResponseHandler() {

                    @Override
                    public void onSuccess(int statusCode, String content) {
                        super.onSuccess(statusCode, content);
                        try {
                            iRequest.request(new Pair<Boolean, String>(JSON.parseObject(content)
                                    .getInteger("status") == 1 ? true : false, JSON.parseObject(
                                    content).getString(MSG)));
                        } catch (Exception e) {
                            e.printStackTrace();
                            iRequest.request(null);
                        }
                    }

                    @Override
                    public void onFailure(Throwable error, String content) {
                        super.onFailure(error, content);
                        iRequest.request(null);
                    }
                });
    }

    @Override
    public void addAddress(String userId, int provincesID, int cityID, int areaID, String address,
            String userName, String code, String phone, String email, String addressID,
            final IRequest<Boolean> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_USERID, String.valueOf(userId));
        params.add(PARAM_PROVINCESID, String.valueOf(provincesID));
        params.add(PARAM_CITYID, String.valueOf(cityID));
        params.add(PARAM_AREAID, String.valueOf(areaID));
        params.add(PARAM_ADDRESS, address);
        params.add(PARAM_USERNAME, userName);
        params.add(PARAM_CODE, code);
        params.add(PARAM_PHONE, phone);
        if (!TextUtils.isEmpty(addressID)) {
            params.add(PARAM_ADDRESSID, addressID);
        }
        // params.add(PARAM_EMAIL, email);
        XDHttpClient
                .post2(TextUtils.isEmpty(addressID) ? "http://ts.leepet.com/plugins/API.v1.0/?&a=goods&m=addAddress"
                        : "http://ts.leepet.com/plugins/API.v1.0/?&a=goods&m=editAddress", params,
                        new AsyncHttpResponseHandler() {

                            @Override
                            public void onSuccess(int statusCode, String content) {
                                super.onSuccess(statusCode, content);
                                try {
                                    iRequest.request(JSON.parseObject(content).getInteger(STATUS) == 1 ? true
                                            : false);
                                } catch (Exception e) {
                                    e.printStackTrace();
                                    iRequest.request(false);
                                }
                            }

                            @Override
                            public void onFailure(Throwable error, String content) {
                                super.onFailure(error, content);
                                iRequest.request(false);
                            }
                        });
    }

    @Override
    public void deleteAddress(String userID, String addressID, final IRequest<Boolean> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_USERID, userID);
        params.add(PARAM_ADDRESS, addressID);
        XDHttpClient.post2("http://ts.leepet.com/plugins/API.v1.0/?&a=goods&m=delAddress", params,
                new AsyncHttpResponseHandler() {

                    @Override
                    public void onSuccess(int statusCode, String content) {
                        super.onSuccess(statusCode, content);
                        try {
                            iRequest.request(JSON.parseObject(content).getInteger("status") == 1 ? true
                                    : false);
                        } catch (Exception e) {
                            e.printStackTrace();
                            iRequest.request(false);
                        }
                    }

                    @Override
                    public void onFailure(Throwable error, String content) {
                        super.onFailure(error, content);
                        iRequest.request(false);
                    }
                });
    }

    @Override
    public void editAddress(String userId, int provincesID, int cityID, int areaID, String address,
            String userName, String code, String phone, String email, String addressID,
            final IRequest<Boolean> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_USERID, String.valueOf(userId));
        params.add(PARAM_PROVINCESID, String.valueOf(provincesID));
        params.add(PARAM_CITYID, String.valueOf(cityID));
        params.add(PARAM_AREAID, String.valueOf(areaID));
        params.add(PARAM_ADDRESS, address);
        params.add(PARAM_USERNAME, userName);
        params.add(PARAM_CODE, code);
        params.add(PARAM_PHONE, phone);
        // params.add(PARAM_EMAIL, email);
        params.add(PARAM_ADDRESSID, addressID);
        XDHttpClient.post2("http://ts.leepet.com/plugins/API.v1.0/?&a=goods&m=editAddress", params,
                new AsyncHttpResponseHandler() {

                    @Override
                    public void onSuccess(int statusCode, String content) {
                        super.onSuccess(statusCode, content);
                        try {
                            iRequest.request(JSON.parseObject(content).getInteger("status") == 1 ? true
                                    : false);
                        } catch (Exception e) {
                            e.printStackTrace();
                            iRequest.request(false);
                        }
                    }

                    @Override
                    public void onFailure(Throwable error, String content) {
                        super.onFailure(error, content);
                        iRequest.request(false);
                    }
                });
    }

    @Override
    public void getMyAddress(String userID, final IRequest<List<AddressInfo>> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_USERID, String.valueOf(userID));
        XDHttpClient.post2("http://ts.leepet.com/plugins/API.v1.0/?&a=goods&m=myAddress", params,
                new AsyncHttpResponseHandler() {

                    @Override
                    public void onSuccess(int statusCode, String content) {
                        super.onSuccess(statusCode, content);
                        AddressInfo parseObject = JSON.parseObject(content, AddressInfo.class);
                        if ("1".equals(parseObject.status)) {
                            try {
                                iRequest.request(JSON.parseArray(JSON.parseObject(content)
                                        .getJSONArray(DATA).toJSONString(), AddressInfo.class));
                            } catch (Exception e) {
                                e.printStackTrace();
                                iRequest.request(new ArrayList<AddressInfo>());
                            }
                        } else {
                            iRequest.request(new ArrayList<AddressInfo>());
                        }
                    }

                    @Override
                    public void onFailure(Throwable error, String content) {
                        super.onFailure(error, content);
                        iRequest.request(null);
                    }
                });
    }

    @Override
    public void getMyAddressDetail(String userID, String addressID,
            final IRequest<AddressDetailInfo> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_USERID, userID);
        params.add(PARAM_ADDRESSID, addressID);
        XDHttpClient.post2("http://ts.leepet.com/plugins/API.v1.0/?&a=goods&m=addressDetail",
                params, new AsyncHttpResponseHandler() {

                    @Override
                    public void onSuccess(int statusCode, String content) {
                        super.onSuccess(statusCode, content);
                        try {
                            iRequest.request(JSON.parseObject(JSON.parseObject(content)
                                    .getJSONObject(DATA).toJSONString(), AddressDetailInfo.class));
                        } catch (Exception e) {
                            e.printStackTrace();
                            iRequest.request(null);
                        }
                    }

                    @Override
                    public void onFailure(Throwable error, String content) {
                        super.onFailure(error, content);
                        iRequest.request(null);
                    }
                });
    }

    @Override
    public void setDefaultAddressDetail(String userID, String addressID,
            final IRequest<Boolean> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_USERID, userID);
        params.add(PARAM_ADDRESSID, addressID);
        XDHttpClient.post2("http://ts.leepet.com/plugins/API.v1.0/?&a=goods&m=setAddressDefault",
                params, new AsyncHttpResponseHandler() {

                    @Override
                    public void onSuccess(int statusCode, String content) {
                        super.onSuccess(statusCode, content);
                        try {
                            iRequest.request(JSON.parseObject(content).getInteger("status") == 1 ? true
                                    : false);
                        } catch (Exception e) {
                            e.printStackTrace();
                            iRequest.request(false);
                        }
                    }

                    @Override
                    public void onFailure(Throwable error, String content) {
                        super.onFailure(error, content);
                        iRequest.request(false);
                    }
                });
    }

    @Override
    public void getDefaultAddress(String userID, final IRequest<AddressDetailInfo> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_USERID, userID);
        XDHttpClient.post2("http://ts.leepet.com/plugins/API.v1.0/?&a=goods&m=getDefaultAddress",
                params, new AsyncHttpResponseHandler() {

                    @Override
                    public void onSuccess(int statusCode, String content) {
                        super.onSuccess(statusCode, content);
                        try {
                            iRequest.request(JSON.parseObject(JSON.parseObject(content)
                                    .getJSONObject(DATA).toJSONString(), AddressDetailInfo.class));
                        } catch (Exception e) {
                            e.printStackTrace();
                            iRequest.request(null);
                        }
                    }

                    @Override
                    public void onFailure(Throwable error, String content) {
                        super.onFailure(error, content);
                        iRequest.request(null);
                    }
                });
    }

    @Override
    public void addOrder(String userID, String addressID, String recID, String order_amount,
            String shipping_fee, String postscript, String bestTime,
            final IRequest<OrderInfo> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_USERID, CommonUtil.decode(userID));
        params.add(PARAM_ADDRESSID, CommonUtil.decode(addressID));
        params.add(PARAM_RECID, CommonUtil.decode(recID));
        params.add(PARAM_ORDER_AMOUNT, CommonUtil.decode(order_amount));
        params.add(PARAM_SHIPPING_FEE, CommonUtil.decode(shipping_fee));
        params.add(PARAM_POSTSCRIPT, CommonUtil.decode(postscript));
        params.add(PARAM_BESTTIME, CommonUtil.decode(bestTime));
        params.add(PARAM_VERSION, VERSION);
        XDHttpClient.post2("http://ts.leepet.com/plugins/API.v1.0/?&a=order&m=addOrder", params,
                new AsyncHttpResponseHandler() {

                    @Override
                    public void onSuccess(int statusCode, String content) {
                        super.onSuccess(statusCode, content);
                        try {
                            if (JSON.parseObject(content).getInteger(STATUS) == 1) {
                                iRequest.request(JSON.parseObject(JSON.parseObject(content)
                                        .getJSONObject(DATA).toJSONString(), OrderInfo.class));
                            } else {
                                iRequest.request(null);
                            }
                        } catch (Exception e) {
                            e.printStackTrace();
                            iRequest.request(null);
                        }
                    }

                    @Override
                    public void onFailure(Throwable error, String content) {
                        super.onFailure(error, content);
                        iRequest.request(null);
                    }
                });
    }

    @Override
    public void getCartList(String userID, final IRequest<String> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_USERID, userID);
        XDHttpClient.post2("http://ts.leepet.com/plugins/API.v1.0/?&a=order&m=addOrder", params,
                new AsyncHttpResponseHandler() {

                    @Override
                    public void onSuccess(int statusCode, String content) {
                        super.onSuccess(statusCode, content);
                        try {
                            if (JSON.parseObject(content).getInteger(STATUS) == 1) {
                                iRequest.request(JSON.parseObject(content).getJSONObject(DATA)
                                        .getString(ORDER_SN));
                            } else {
                                iRequest.request(null);
                            }
                        } catch (Exception e) {
                            e.printStackTrace();
                            iRequest.request(null);
                        }
                    }

                    @Override
                    public void onFailure(Throwable error, String content) {
                        super.onFailure(error, content);
                        iRequest.request(null);
                    }
                });
    }

    @Override
    public void getReplyList(String userID, int page, int pageSize,
            final IRequest<List<ReplyInfo>> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_USERID, userID);
        params.add(PARAM_PAGE, String.valueOf(page));
        params.add(PARAM_PAGESIZE, String.valueOf(pageSize));
        XDHttpClient.post2("http://bbs.chinapet.com/plugin.php?id=leepet_thread:api&action=mypost",
                params, new AsyncHttpResponseHandler() {

                    @Override
                    public void onSuccess(int statusCode, String content) {
                        super.onSuccess(statusCode, content);
                        try {
                            iRequest.request(JSON.parseArray(JSON.parseObject(content)
                                    .getJSONArray(ARRAY).toJSONString(), ReplyInfo.class));
                        } catch (Exception e) {
                            e.printStackTrace();
                            iRequest.request(null);
                        }
                    }

                    @Override
                    public void onFailure(Throwable error, String content) {
                        super.onFailure(error, content);
                        iRequest.request(null);
                    }
                });
    }

    @Override
    public void getInformMessageList(String userID, int page, int pageSize,
            final IRequest<List<InformMessage>> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_USERID, userID);
        params.add(PARAM_PAGE, String.valueOf(page));
        params.add(PARAM_PAGESIZE, String.valueOf(pageSize));
        XDHttpClient.post2(
                "http://bbs.chinapet.com/plugin.php?id=leepet_thread:api&action=notice_sys_list",
                params, new AsyncHttpResponseHandler() {

                    @Override
                    public void onSuccess(int statusCode, String content) {
                        super.onSuccess(statusCode, content);
                        try {
                            iRequest.request(JSON.parseArray(JSON.parseObject(content)
                                    .getJSONArray(ARRAY).toJSONString(), InformMessage.class));
                        } catch (Exception e) {
                            e.printStackTrace();
                            iRequest.request(null);
                        }
                    }

                    @Override
                    public void onFailure(Throwable error, String content) {
                        super.onFailure(error, content);
                        iRequest.request(null);
                    }
                });
    }

    @Override
    public void getMyInformMessageList(String userID, int page, int pageSize,
            final IRequest<List<MyInformMessage>> iRequest) {
        // TODO Auto-generated method stub

        RequestParams params = new RequestParams();
        params.add(PARAM_USERID, userID);
        params.add(PARAM_PAGE, String.valueOf(page));
        params.add(PARAM_PAGESIZE, String.valueOf(pageSize));
        XDHttpClient.post2(
                "http://bbs.chinapet.com/plugin.php?id=leepet_thread:api&action=notice_sys_list",
                params, new AsyncHttpResponseHandler() {

                    @Override
                    public void onSuccess(int statusCode, String content) {
                        super.onSuccess(statusCode, content);
                        try {
                            iRequest.request(JSON.parseArray(JSON.parseObject(content)
                                    .getJSONArray(ARRAY).toJSONString(), MyInformMessage.class));
                        } catch (Exception e) {
                            e.printStackTrace();
                            iRequest.request(null);
                        }
                    }

                    @Override
                    public void onFailure(Throwable error, String content) {
                        super.onFailure(error, content);
                        iRequest.request(null);
                    }
                });


    }

    @Override
    public void deleteInformMessage(String notice_id, final IRequest<Pair<Boolean, String>> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_NOTICEID, notice_id);
        XDHttpClient.post2(
                "http://bbs.chinapet.com/plugin.php?id=leepet_thread:api&action=notice_delete",
                params, new AsyncHttpResponseHandler() {

                    @Override
                    public void onSuccess(int statusCode, String content) {
                        super.onSuccess(statusCode, content);
                        try {
                            iRequest.request(new Pair<Boolean, String>(JSON.parseObject(content)
                                    .getInteger(RESULT) == 0 ? true : false, JSON.parseObject(
                                    content).getString("msg")));
                        } catch (Exception e) {
                            e.printStackTrace();
                            iRequest.request(null);
                        }
                    }

                    @Override
                    public void onFailure(Throwable error, String content) {
                        super.onFailure(error, content);
                        iRequest.request(null);
                    }
                });
    }

    @Override
    public void getPrivateMessageList(int page, int pageSize,
            final IRequest<List<MessageInfo>> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_ID, LEEPET_THREAD_API);
        params.add(PARAM_ACTION, ACTION_MESSAGE_PRIVATE_LIST);
        params.add(PARAM_PAGE, String.valueOf(page));
        params.add(PARAM_PAGESIZE, String.valueOf(pageSize));
        XDHttpClient.post2(BASEURL, params, new AsyncHttpResponseHandler() {

            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                try {
                    iRequest.request(JSON.parseArray(JSON.parseObject(content).getJSONArray(ARRAY)
                            .toJSONString(), MessageInfo.class));
                } catch (Exception e) {
                    e.printStackTrace();
                    iRequest.request(null);
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });
    }

    @Override
    public void getPrivateMessageListWithUid(String touid,
            final IRequest<List<PrivateMessageInfo>> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_ID, LEEPET_THREAD_API);
        params.add(PARAM_ACTION, ACTION_MESSAGE_PRIVATE_SHOW);
        params.add(PARAM_TOUID, touid);
        params.add(PARAM_PAGE, "0");
        params.add(PARAM_PAGESIZE, "100");
        XDHttpClient.post2(BASEURL, params, new AsyncHttpResponseHandler() {

            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                try {
                    if (JSON.parseObject(content).getString("result").equals("0")) {
                        iRequest.request(JSON.parseArray(
                                JSON.parseObject(content).getJSONArray(ARRAY).toJSONString(),
                                PrivateMessageInfo.class));
                    } else {
                        iRequest.request(new ArrayList<PrivateMessageInfo>());
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                    iRequest.request(null);
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });
    }

    @Override
    public void sendPrivateMessage(String username, String message,
            final IRequest<SendPrivateLetterReturnResult> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_ID, LEEPET_THREAD_API);
        params.add(PARAM_ACTION, ACTION_MESSAGE_SEND);
        params.add(PARAM_USERNAME_, username);
        params.add(PARAM_MESSAGE, message);
        XDHttpClient.post2(BASEURL, params, new AsyncHttpResponseHandler() {

            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                try {
                    // iRequest.request(new Pair<Boolean, String>(JSON.parseObject(content)
                    // .getInteger(RESULT) == 0 ? true : false, JSON.parseObject(content)
                    // .getString("msg")));
                    iRequest.request(JSON.parseObject(content, SendPrivateLetterReturnResult.class));

                } catch (Exception e) {
                    e.printStackTrace();
                    iRequest.request(null);
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });
    }

    @Override
    public void ignorePrivateMessageWithUid(String username,
            final IRequest<Pair<Boolean, String>> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_ID, LEEPET_THREAD_API);
        params.add(PARAM_ACTION, ACTION_MESSAGE_IGNORE);
        params.add(PARAM_TOUSERNAME, username);
        XDHttpClient.post2(BASEURL, params, new AsyncHttpResponseHandler() {

            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                try {
                    iRequest.request(new Pair<Boolean, String>(JSON.parseObject(content)
                            .getInteger(RESULT) == 0 ? true : false, JSON.parseObject(content)
                            .getString("msg")));
                } catch (Exception e) {
                    e.printStackTrace();
                    iRequest.request(null);
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });
    }

    @Override
    public void deletePrivateMessageWithUid(String touid,
            final IRequest<Pair<Boolean, String>> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_ID, LEEPET_THREAD_API);
        params.add(PARAM_ACTION, ACTION_MESSAGE_DELETE);
        params.add(PARAM_TOUID, touid);
        // params.add(PARAM_PMID, pmid);
        XDHttpClient.post2(BASEURL, params, new AsyncHttpResponseHandler() {

            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                try {
                    iRequest.request(new Pair<Boolean, String>(JSON.parseObject(content)
                            .getInteger(RESULT) == 0 ? true : false, JSON.parseObject(content)
                            .getString("msg")));
                } catch (Exception e) {
                    e.printStackTrace();
                    iRequest.request(null);
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });
    }

    @Override
    public void getFreight(String recID, int provinceID, final IRequest<Float> iRequest) {
        RequestParams params = new RequestParams();
        params.add("recID", recID);
        params.add("provinceID", String.valueOf(provinceID));
        XDHttpClient.post2("http://ts.leepet.com/plugins/API.v1.0/?&a=order&m=getShippingFee",
                params, new AsyncHttpResponseHandler() {

                    @Override
                    public void onSuccess(int statusCode, String content) {
                        super.onSuccess(statusCode, content);
                        try {
                            iRequest.request(JSON.parseObject(content).getJSONObject(DATA)
                                    .getFloat("shipping_fee"));
                            // iRequest.request(new Pair<Boolean,
                            // String>(JSON.parseObject(content).getInteger(
                            // RESULT) == 0 ? true : false,
                            // JSON.parseObject(content).getString("msg")));
                        } catch (Exception e) {
                            e.printStackTrace();
                            iRequest.request(0f);
                        }
                    }

                    @Override
                    public void onFailure(Throwable error, String content) {
                        super.onFailure(error, content);
                        iRequest.request(0f);
                    }
                });
    }

    @Override
    public void deletePrivateMessage(String touid, String pmid,
            final IRequest<Pair<Boolean, String>> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_ID, LEEPET_THREAD_API);
        params.add(PARAM_ACTION, ACTION_MESSAGE_DELETE);
        params.add(PARAM_TOUID, touid);
        params.add(PARAM_PMID, pmid);
        XDHttpClient.post2(BASEURL, params, new AsyncHttpResponseHandler() {

            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                try {
                    iRequest.request(new Pair<Boolean, String>(JSON.parseObject(content)
                            .getInteger(RESULT) == 0 ? true : false, JSON.parseObject(content)
                            .getString("msg")));
                } catch (Exception e) {
                    e.printStackTrace();
                    iRequest.request(null);
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });
    }

    @Override
    public void getPostFirstDetail(String uid, String tid,
            final IRequest<PostLandlordInfos> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_ID, LEEPET_THREAD_API);
        params.add(PARAM_ACTION, ACTION_THREAD_SHOW_FIRST);
        params.add(PARAM_ISAPPLE, String.valueOf(1));
        params.add(PARAM_UID, uid);
        params.add(PARAM_TID, tid);
        XDHttpClient.post2(BASEURL, params, new AsyncHttpResponseHandler() {

            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                try {
                    iRequest.request(JSON.parseObject(content, PostLandlordInfos.class));
                } catch (Exception e) {
                    e.printStackTrace();
                    iRequest.request(null);
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });
    }

    @Override
    public void getPostLayerDetail(String uid, String tid, String onlyauthor, String pidList,
            int page, int pageSize, int order, final IRequest<PostLayerInfos> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_ID, LEEPET_THREAD_API);
        params.add(PARAM_ACTION, ACTION_THREAD_SHOW_LAYER);
        params.add(PARAM_ISAPPLE, String.valueOf(1));
        params.add(PARAM_UID, uid);
        params.add(PARAM_TID, tid);
        if (!TextUtils.isEmpty(pidList)) {
            params.add(PARAM_PIDLIST, pidList);
        }
        if (!TextUtils.isEmpty(onlyauthor)) {
            params.add(PARAM_ONLYAUTHOR, onlyauthor);
        }
        params.add("isdesc", String.valueOf(order));
        params.add(PARAM_PAGE, String.valueOf(page));
        params.add(PARAM_PAGESIZE, String.valueOf(pageSize));
        // params.add(PARAM_POSITION, String.valueOf(floor));
        XDHttpClient.post2(BASEURL, params, new AsyncHttpResponseHandler() {

            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                try {
                    iRequest.request(JSON.parseObject(content, PostLayerInfos.class));
                } catch (Exception e) {
                    e.printStackTrace();
                    iRequest.request(null);
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });
    }

    @Override
    public void getMyPost(String uid, int page, int pageSize, final IRequest<List<Message>> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_ID, LEEPET_THREAD_API);
        params.add(PARAM_ACTION, ACTION_MYTHREAD);
        params.add(PARAM_UID, uid);
        params.add(PARAM_PAGE, String.valueOf(page));
        params.add(PARAM_PAGESIZE, String.valueOf(pageSize));
        XDHttpClient.post2(BASEURL, params, new AsyncHttpResponseHandler() {

            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                try {
                    iRequest.request(JSON.parseArray(
                            JSON.parseObject(content).getJSONArray(RESPONSE_ARRAY).toJSONString(),
                            Message.class));
                } catch (Exception e) {
                    e.printStackTrace();
                    iRequest.request(null);
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });
    }

    @Override
    public void getMyReply(String uid, int page, int pageSize,
            final IRequest<List<Message>> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_ID, LEEPET_THREAD_API);
        params.add(PARAM_ACTION, ACTION_MYPOST);
        params.add(PARAM_UID, uid);
        params.add(PARAM_PAGE, String.valueOf(page));
        params.add(PARAM_PAGESIZE, String.valueOf(pageSize));
        XDHttpClient.post2(BASEURL, params, new AsyncHttpResponseHandler() {

            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                try {
                    iRequest.request(JSON.parseArray(
                            JSON.parseObject(content).getJSONArray(RESPONSE_ARRAY).toJSONString(),
                            Message.class));
                } catch (Exception e) {
                    e.printStackTrace();
                    iRequest.request(null);
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });
    }

    @Override
    public void getLoginBinStatus(final IRequest<String> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_ID, LEEPET_THREAD_API);
        params.add(PARAM_ACTION, ACTION_LOGINBINSTATUS);
        XDHttpClient.post2(BASEURL, params, new AsyncHttpResponseHandler() {

            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                try {
                    iRequest.request(content);
                } catch (Exception e) {
                    e.printStackTrace();
                    iRequest.request(null);
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });
    }

    @Override
    public void login(String username, String password, final IRequest<Map<String, Object>> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_ID, LEEPET_THREAD_API);
        params.add(PARAM_ACTION, ACTION_LOGIN);
        params.add(PARAM_USERNAME_, username);
        params.add(PARAM_PASSWORD, password);
        XDHttpClient.post2(BASEURL, params, new AsyncHttpResponseHandler() {

            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                iRequest.request(parseLoginResult(content));
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });
    }

    @Override
    public void loginByQQ(String conuin, String conuinsecret, String conopenid,
            final IRequest<Map<String, Object>> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_ID, LEEPET_THREAD_API);
        params.add(PARAM_ACTION, ACTION_QQLOGINCHECK);
        params.add("gobind", "1");
        params.add("conuin", conuin);
        params.add("conuinsecret", conuinsecret);
        params.add("conopenid", conopenid);
        XDHttpClient.post2(BASEURL, params, new AsyncHttpResponseHandler() {

            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                iRequest.request(parseLoginResult(content));
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });
    }

    private Map<String, Object> parseLoginResult(String content) {
        try {
            Map<String, Object> map = new HashMap<String, Object>();
            com.alibaba.fastjson.JSONObject jo = JSON.parseObject(content);
            map.put(RESPONSE_RESULT, jo.getInteger(RESPONSE_RESULT));
            map.put(RESPONSE_MSG, jo.getString(RESPONSE_MSG));
            if (jo.containsKey(RESPONSE_USERINFO)) {
                map.put(RESPONSE_USERINFO, com.alibaba.fastjson.JSON.parseObject(new JSONObject(
                        content).getJSONObject(RESPONSE_USERINFO).toString(), User.class));
            }
            return map;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

    @Override
    public void loginBySina(String sina_uid, String token, String oauth2_expiretime,
            final IRequest<Map<String, Object>> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_ID, LEEPET_THREAD_API);
        params.add(PARAM_ACTION, ACTION_WBLOGINCHECK);
        params.add("gobind", "1");
        params.put("sina_uid", sina_uid);
        params.put("token", token);
        params.put("oauth2_expiretime", oauth2_expiretime);
        XDHttpClient.post2(BASEURL, params, new AsyncHttpResponseHandler() {

            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                iRequest.request(parseLoginResult(content));
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });
    }



    @Override
    public void loginByWeiXin(String expires_in, String openid, String access_token,
            String userparm, final IRequest<Map<String, Object>> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_ID, LEEPET_THREAD_API);
        params.add(PARAM_ACTION, ACTION_WeiXinLOGINCHECK);
        params.add("expires_in", "1");
        params.put("openid", openid);
        params.put("access_token", access_token);
        params.put("sina_uid", expires_in);
        params.put("userparm", userparm);
        XDHttpClient.post2(BASEURL, params, new AsyncHttpResponseHandler() {

            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                iRequest.request(parseLoginResult(content));
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });
    }

    @Override
    public void register(String username, String password, String email,
            final IRequest<Map<String, Object>> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_ID, LEEPET_THREAD_API);
        params.add(PARAM_ACTION, ACTION_REG);
        params.put("username", username);
        params.put("password", password);
        params.put("email", email);
        AddClient.post(BASEURL, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                iRequest.request(parseLoginResult(content));
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
            }
        });
    }

    @Override
    public void getPassword(String email, final IRequest<KeyValuePair<Integer, String>> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_ID, LEEPET_THREAD_API);
        params.add(PARAM_ACTION, ACTION_GETPASSWD);
        params.put(PARAM_EMAIL, email);
        AddClient.post(BASEURL, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                try {
                    JSONObject jo = new JSONObject(content);
                    iRequest.request(new KeyValuePair<Integer, String>(jo.getInt(RESPONSE_RESULT),
                            jo.getString(RESPONSE_MSG)));
                } catch (Exception e) {
                    e.printStackTrace();
                    iRequest.request(null);
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });
    }

    @Override
    public void addFollowAdd(String followUid, String followUsername,
            final IRequest<Boolean> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_ID, LEEPET_THREAD_API);
        params.add(PARAM_ACTION, ACTION_FOLLOWADD);
        params.put("follow_uid", followUid);
        params.put("follow_username", followUsername);
        AddClient.post(BASEURL, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                try {
                    iRequest.request(new JSONObject(content).getInt(RESPONSE_RESULT) == 0 ? true
                            : false);
                } catch (Exception e) {
                    e.printStackTrace();
                    iRequest.request(false);
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(false);
            }
        });
    }

    @Override
    public void deleteFollowAdd(String follow_uid, final IRequest<Boolean> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_ID, LEEPET_THREAD_API);
        params.add(PARAM_ACTION, ACTION_FOLLOWDEL);
        params.put("follow_uid", follow_uid);
        AddClient.post(BASEURL, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                try {
                    iRequest.request(new JSONObject(content).getInt(RESPONSE_RESULT) == 0 ? true
                            : false);
                } catch (Exception e) {
                    e.printStackTrace();
                    iRequest.request(false);
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(false);
            }
        });
    }

    @Override
    public void getUserInfoByUid(String uid, final IRequest<Map<String, Object>> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_ID, LEEPET_THREAD_API);
        params.add(PARAM_ACTION, ACTION_GETUSERINFOBYUID);
        params.put(PARAM_UID, uid);
        AddClient.post(BASEURL, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                iRequest.request(parseLoginResult(content));
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });
    }

    @Override
    public void getMessageCenterInfos(int page, int pageSize,
            final IRequest<KeyValuePair<Integer, List<MessageCenterInfo>>> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_ID, LEEPET_THREAD_API);
        params.add(PARAM_ACTION, ACTION_MESSAGECENTER);
        params.add(PARAM_PAGE, String.valueOf(page));
        params.add(PARAM_PAGESIZE, String.valueOf(pageSize));
        AddClient.post(BASEURL, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                try {
                    iRequest.request(new KeyValuePair<Integer, List<MessageCenterInfo>>(
                            new JSONObject(content).getInt(RESPONSE_ISNEW), JSON
                                    .parseArray(new JSONObject(content)
                                            .getJSONArray(RESPONSE_ARRAY).toString(),
                                            MessageCenterInfo.class)));
                } catch (Exception e) {
                    e.printStackTrace();
                    iRequest.request(null);
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });
    }



    @Override
    public void getReplyMessageCenterInfos(int page, int pageSize,
            final IRequest<List<MessageCenterInfo>> iRequest) {
        // TODO Auto-generated method stub

        RequestParams params = new RequestParams();
        params.add(PARAM_ID, LEEPET_THREAD_API);
        params.add(PARAM_ACTION, ACTION_REPLY);
        params.add(PARAM_PAGE, String.valueOf(page));
        params.add(PARAM_PAGESIZE, String.valueOf(pageSize));
        AddClient.post(BASEURL, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                try {
                    iRequest.request(JSON.parseArray(
                            new JSONObject(content).getJSONArray(RESPONSE_ARRAY).toString(),
                            MessageCenterInfo.class));
                } catch (Exception e) {
                    e.printStackTrace();
                    iRequest.request(null);
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });


    }


    @Override
    public void getAtMessageCenterInfos(int page, int pageSize,
            final IRequest<List<MessageCenterInfo>> iRequest) {

        RequestParams params = new RequestParams();
        params.add(PARAM_ID, LEEPET_THREAD_API);
        params.add(PARAM_ACTION, ACTION_AT);
        params.add(PARAM_PAGE, String.valueOf(page));
        params.add(PARAM_PAGESIZE, String.valueOf(pageSize));
        AddClient.post(BASEURL, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                try {
                    iRequest.request(JSON.parseArray(
                            new JSONObject(content).getJSONArray(RESPONSE_ARRAY).toString(),
                            MessageCenterInfo.class));
                } catch (Exception e) {
                    e.printStackTrace();
                    iRequest.request(null);
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });



    }


    @Override
    public void getMyMessageInfo(int page, int pageSize, final IRequest<MyMessageInfo> iRequest) {
        // TODO Auto-generated method stub

        RequestParams params = new RequestParams();
        params.add(PARAM_ID, LEEPET_THREAD_API);
        // params.add(PARAM_ACTION, ACTION_MESSAGECENTER);
        params.add(PARAM_ACTION, ACTION_MESSAGECENTER_NEW);
        // params.add(PARAM_ACTION, ACTION_MESSAGECENTER);
        params.add(PARAM_ACTION, "messagecate");
        params.add(PARAM_PAGE, String.valueOf(page));
        params.add(PARAM_PAGESIZE, String.valueOf(pageSize));
        AddClient.post(BASEURL, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                try {
                    MyMessageInfo info = JSON.parseObject(content, MyMessageInfo.class);
                    iRequest.request(info);
                } catch (Exception e) {
                    e.printStackTrace();
                    iRequest.request(null);
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });


    }



    @Override
    public void deleteNoticeMessage(String noticeId, boolean issys, final IRequest<Boolean> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_ID, LEEPET_THREAD_API);
        params.add(PARAM_ACTION, ACTION_NOTICEDELETE);
        params.add("notice_id", noticeId);
        if (issys) {
            params.add("issys", "1");
        }
        AddClient.post(BASEURL, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                try {
                    iRequest.request(new JSONObject(content).getInt(RESPONSE_RESULT) == 0 ? true
                            : false);
                } catch (Exception e) {
                    e.printStackTrace();
                    iRequest.request(false);
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(false);
            }
        });
    }

    @Override
    public void quickLoginByQQ(String username, String conuin, String conuinsecret,
            String conopenid, String userparm, final IRequest<Map<String, Object>> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_ID, LEEPET_THREAD_API);
        params.add(PARAM_ACTION, "sflogin_quick");
        params.put("newusername", username);
        params.put("conuin", conuin);
        params.put("conuinsecret", conuinsecret);
        params.put("conopenid", conopenid);
        params.put("userparm", userparm);
        params.put("come", "qq");
        AddClient.post(BASEURL, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                iRequest.request(parseLoginResult(content));
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });
    }

    @Override
    public void bindSina(String sina_uid, String token, String oauth2_expiretime, String username,
            String password, final IRequest<Map<String, Object>> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_ID, LEEPET_THREAD_API);
        params.add(PARAM_ACTION, "wbloginadd");
        params.put("sina_uid", sina_uid);
        params.put("token", token);
        params.put("oauth2_expiretime", oauth2_expiretime);
        params.put("username", username);
        params.put("password", password);
        AddClient.post(BASEURL, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                iRequest.request(parseLoginResult(content));
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });
    }

    @Override
    public void bindQQ(String conuin, String conuinsecret, String conopenid, String username,
            String password, final IRequest<Map<String, Object>> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_ID, LEEPET_THREAD_API);
        params.add(PARAM_ACTION, "qqloginadd");
        params.put("username", username);
        params.put("password", password);
        params.put("conuin", conuin);
        params.put("conuinsecret", conuinsecret);
        params.put("conopenid", conopenid);
        AddClient.post(BASEURL, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                iRequest.request(parseLoginResult(content));
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });
    }

    @Override
    public void quickLoginBySina(String username, String sina_uid, String token,
            String oauth2_expiretime, final IRequest<Map<String, Object>> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_ID, LEEPET_THREAD_API);
        params.add(PARAM_ACTION, "sflogin_quick");
        params.put("newusername", username);
        params.put("sina_uid", sina_uid);
        params.put("token", token);
        params.put("oauth2_expiretime", oauth2_expiretime);
        params.put("come", "wb");
        // params.put("come", "wx");
        AddClient.post(BASEURL, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                iRequest.request(parseLoginResult(content));
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });
    }

    @Override
    public void quickLoginByWeiXin(String username, String weixin_expires_in, String weixin_openid,
            String weixin_access_token, final IRequest<Map<String, Object>> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_ID, LEEPET_THREAD_API);
        params.add(PARAM_ACTION, "sflogin_quick");
        params.put("newusername", username);
        params.put("expires_in", weixin_expires_in);
        params.put("openid", weixin_openid);
        params.put("access_token", weixin_access_token);
        params.put("userparm", MoccaPreferences.WEIXIN_USERPAREMS.get());
        params.put("come", "wx");
        System.out.println(params.toString() + "结束");
        System.out.println("username:" + username + "weixin_expires_in:" + weixin_expires_in
                + "weixin_openid:" + weixin_openid + "weixin_access_token:" + weixin_access_token
                + "userparm:" + MoccaPreferences.WEIXIN_USERPAREMS.get());
        AddClient.post(BASEURL, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                iRequest.request(parseLoginResult(content));
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });
    }

    @Override
    public void noticeClick(String noticeId, final IRequest<Boolean> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_ID, LEEPET_THREAD_API);
        params.add(PARAM_ACTION, ACTION_NOTICECLICK);
        params.add(PARAM_NOTICEID, noticeId);
        AddClient.post(BASEURL, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                try {
                    iRequest.request(new JSONObject(content).getInt(RESPONSE_ISNEW) == 0 ? false
                            : true);
                } catch (JSONException e) {
                    e.printStackTrace();
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(false);
            }
        });
    }

    @Override
    public void noticeCleanAllNew(final IRequest<Boolean> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_ID, LEEPET_THREAD_API);
        params.add(PARAM_ACTION, ACTION_NOTICE_CLEANNEW);
        AddClient.post(BASEURL, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                try {
                    iRequest.request(new JSONObject(content).getInt(RESPONSE_ISNEW) == 0 ? true
                            : false);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(false);
            }
        });
    }

    @Override
    public void userLocalCheck(String friendTid, String meituTid, double lat, double lng,
            String address, String jpush, String phoenType, String phonesystem,
            String phonesystemver, String clientver, final IRequest<HasNew> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_ID, LEEPET_THREAD_API);
        params.add(PARAM_ACTION, ACTION_USER_LOCAL_CHECK);
        params.add("lat", String.valueOf(lat));
        params.add("lng", String.valueOf(lng));
        params.add("address", address);
        params.add("jpush", jpush);
        params.add("phonetype", phoenType);
        params.add("phonesystem", phonesystem);
        params.add("phonesystemver", phonesystemver);
        params.add("clientver", clientver);
        params.add("follow_tid", friendTid);
        params.add("pic_tid", meituTid);
        AddClient.post(BASEURL, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                iRequest.request(JSON.parseObject(content, HasNew.class));
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });
    }

    @Override
    public void getMyTasklist(final IRequest<List<MyTasklist>> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_ID, LEEPET_THREAD_API);
        params.add(PARAM_ACTION, ACTION_MYTASKLIST);
        AddClient.post(BASEURL, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                try {
                    iRequest.request(JSON.parseArray(
                            new JSONObject(content).getJSONArray(RESPONSE_ARRAY).toString(),
                            MyTasklist.class));
                } catch (Exception e) {
                    e.printStackTrace();
                    iRequest.request(null);
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });
    }

    @Override
    public void getChangePager(final IRequest<List<InteralBanner>> iRequest) {
        RequestParams params = new RequestParams();
        AddClient.post("http://ts.leepet.com/plugins/API.v1.0/?&a=goods&m=integralBanner", params,
                new AsyncHttpResponseHandler() {
                    @Override
                    public void onSuccess(int statusCode, String content) {
                        super.onSuccess(statusCode, content);
                        try {
                            iRequest.request(JSON.parseArray(JSON.parseObject(content)
                                    .getJSONArray(DATA).toJSONString(), InteralBanner.class));
                        } catch (Exception e) {
                            e.printStackTrace();
                            iRequest.request(null);
                        }
                    }

                    @Override
                    public void onFailure(Throwable error, String content) {
                        super.onFailure(error, content);
                        iRequest.request(null);
                    }
                });
    }

    /*
     * private Map<String, Object> tasklistResult(String content) { try { Map<String, Object> map =
     * new HashMap<String, Object>(); com.alibaba.fastjson.JSONObject jo =
     * JSON.parseObject(content); map.put(RESPONSE_RESULT, jo.getInteger(RESPONSE_RESULT));
     * map.put(RESPONSE_MSG, jo.getString(RESPONSE_MSG)); map.put(RESPONSE_NIUNIU,
     * jo.getString(RESPONSE_NIUNIU)); if (jo.containsKey(RESPONSE_ARRAY)) { List<MyTasklist> list =
     * JSON.parseArray(new JSONObject(content).getJSONArray(RESPONSE_ARRAY) .toString(),
     * MyTasklist.class); map.put(RESPONSE_ARRAY, JSON.parseArray( new
     * JSONObject(content).getJSONArray(RESPONSE_ARRAY).toString(), MessageCenterInfo.class));
     * 
     * } return map; } catch (Exception e) { e.printStackTrace(); } return null; }
     */
    @Override
    public void getIndexBanner(String type, final IRequest<HomeBannerEntity> iRequest) {
        try {
            RequestParams params = new RequestParams();
            params.add(PARAM_ID, LEEPET_THREAD_API);
            params.add(PARAM_ACTION, ACTION_INDEXBANNER);
            params.add(PARAM_TYPE, type);
            AddClient.get(BASEURL, params, new AsyncHttpResponseHandler() {
                @Override
                public void onSuccess(int statusCode, String content) {
                    try {
                        HomeBannerEntity parseObject =
                                JSON.parseObject(content, HomeBannerEntity.class);
                        iRequest.request(parseObject);
                    } catch (Exception e) {
                        iRequest.request(null);
                    }
                    super.onSuccess(statusCode, content);
                }

                @Override
                public void onFailure(Throwable error, String content) {
                    iRequest.request(null);
                    super.onFailure(error, content);
                }
            });
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Override
    public void getGroups(final IRequest<Groups> iRequest) {
        try {
            RequestParams params = new RequestParams();
            params.add(PARAM_ID, LEEPET_THREAD_API);
            params.add(PARAM_ACTION, ACTION_RECOMMENDLIST);
            AddClient.get(BASEURL, params, new AsyncHttpResponseHandler() {
                @Override
                public void onSuccess(int statusCode, String content) {
                    try {
                        Groups parseObject = JSON.parseObject(content, Groups.class);
                        iRequest.request(parseObject);
                    } catch (Exception e) {
                        iRequest.request(null);
                    }
                    super.onSuccess(statusCode, content);
                }

                @Override
                public void onFailure(Throwable error, String content) {
                    iRequest.request(null);
                    super.onFailure(error, content);
                }
            });
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Override
    public void getMineGroups(final IRequest<Groups> iRequest) {
        try {
            RequestParams params = new RequestParams();
            params.add(PARAM_ID, LEEPET_THREAD_API);
            params.add(PARAM_ACTION, ACTION_MY_GROUP);
            AddClient.get(BASEURL, params, new AsyncHttpResponseHandler() {
                @Override
                public void onSuccess(int statusCode, String content) {
                    try {
                        Groups parseObject = JSON.parseObject(content, Groups.class);
                        iRequest.request(parseObject);
                    } catch (Exception e) {
                        iRequest.request(null);
                        e.printStackTrace();
                    }
                    super.onSuccess(statusCode, content);
                }

                @Override
                public void onFailure(Throwable error, String content) {
                    iRequest.request(null);
                    super.onFailure(error, content);
                }
            });
        } catch (Exception e) {
            e.printStackTrace();
        }
    }



    @Override
    public void getDongtaiList(RequestParams params, final IRequest<PostListEntity> iRequest) {
        try {
            params.add(PARAM_ID, LEEPET_THREAD_API);
            params.add(PARAM_ACTION, ACTION_DONGTAI_LIST);
            AddClient.get(BASEURL, params, new AsyncHttpResponseHandler() {
                @Override
                public void onSuccess(int statusCode, String content) {
                    try {
                        PostListEntity parseObject =
                                JSON.parseObject(content, PostListEntity.class);
                        iRequest.request(parseObject);
                    } catch (Exception e) {
                        iRequest.request(null);
                        e.printStackTrace();
                    }
                    super.onSuccess(statusCode, content);
                }

                @Override
                public void onFailure(Throwable error, String content) {
                    iRequest.request(null);
                    super.onFailure(error, content);
                }
            });
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Override
    public void getOneGroups(final IRequest<Groups> iRequest) {
        try {
            RequestParams params = new RequestParams();
            params.add(PARAM_ID, LEEPET_THREAD_API);
            params.add(PARAM_ACTION, ACTION_INDEXGROUP);
            AddClient.get(BASEURL, params, new AsyncHttpResponseHandler() {
                @Override
                public void onSuccess(int statusCode, String content) {
                    try {
                        Groups parseObject = JSON.parseObject(content, Groups.class);
                        iRequest.request(parseObject);
                    } catch (Exception e) {
                        iRequest.request(null);
                        e.printStackTrace();
                    }
                    super.onSuccess(statusCode, content);
                }

                @Override
                public void onFailure(Throwable error, String content) {
                    iRequest.request(null);
                    super.onFailure(error, content);
                }
            });
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Override
    public void getTwoGroups(String fid, final IRequest<Groups> iRequest) {
        try {
            RequestParams params = new RequestParams();
            params.add(PARAM_ID, LEEPET_THREAD_API);
            params.add(PARAM_ACTION, ACTION_INDEXFORUM);
            params.add(PARAM_FID, fid);
            AddClient.get(BASEURL, params, new AsyncHttpResponseHandler() {
                @Override
                public void onSuccess(int statusCode, String content) {
                    try {
                        Groups parseObject = JSON.parseObject(content, Groups.class);
                        iRequest.request(parseObject);
                    } catch (Exception e) {
                        iRequest.request(null);
                        e.printStackTrace();
                    }
                    super.onSuccess(statusCode, content);
                }

                @Override
                public void onFailure(Throwable error, String content) {
                    iRequest.request(null);
                    super.onFailure(error, content);
                }
            });
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Override
    public void getChangeList(final IRequest<List<InteralList>> iRequest) {
        RequestParams params = new RequestParams();
        AddClient.post("http://ts.leepet.com/plugins/API.v1.0/?&a=goods&m=getIntegralGoodsList",
                params, new AsyncHttpResponseHandler() {
                    @Override
                    public void onSuccess(int statusCode, String content) {
                        super.onSuccess(statusCode, content);
                        try {
                            iRequest.request(JSON.parseArray(
                                    new JSONObject(content).getJSONArray("data").toString(),
                                    InteralList.class));
                        } catch (Exception e) {
                            e.printStackTrace();
                            iRequest.request(null);
                        }
                    }

                    @Override
                    public void onFailure(Throwable error, String content) {
                        super.onFailure(error, content);
                        iRequest.request(null);
                    }
                });

    }

    @Override
    public void getBeautifulList(int page, int pageSize, final IRequest<MainZuixinData> iRequest) {
        RequestParams params = new RequestParams();
        params.add("page", String.valueOf(page));
        params.add("pageSize", String.valueOf(pageSize));
        AddClient.post(BASEURL + ACTION_BEAUTIFUL, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                try {
                    iRequest.request(JSON.parseObject(content, MainZuixinData.class));
                } catch (Exception e) {
                    e.printStackTrace();
                    iRequest.request(null);
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });

    }

    @Override
    public void getMyGroups(final IRequest<List<GroupInfo>> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_ID, LEEPET_THREAD_API);
        params.add(PARAM_ACTION, ACTION_GROUPMYLIST);
        AddClient.get(BASEURL, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                try {
                    iRequest.request(JSON.parseArray(
                            JSON.parseObject(content).getJSONArray(RESPONSE_ARRAY).toJSONString(),
                            GroupInfo.class));
                } catch (Exception e) {
                    iRequest.request(null);
                }
                super.onSuccess(statusCode, content);
            }

            @Override
            public void onFailure(Throwable error, String content) {
                iRequest.request(null);
                super.onFailure(error, content);
            }
        });
    }

    @Override
    public void getRecommendGroups(final IRequest<List<GroupInfo>> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_ID, LEEPET_THREAD_API);
        params.add(PARAM_ACTION, ACTION_GROUPRECOMMENDLIST);
        AddClient.get(BASEURL, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                try {
                    iRequest.request(JSON.parseArray(
                            JSON.parseObject(content).getJSONArray(RESPONSE_ARRAY).toJSONString(),
                            GroupInfo.class));
                } catch (Exception e) {
                    iRequest.request(null);
                }
                super.onSuccess(statusCode, content);
            }

            @Override
            public void onFailure(Throwable error, String content) {
                iRequest.request(null);
                super.onFailure(error, content);
            }
        });
    }

    @Override
    public void getChangeDesc(String exid, final IRequest<InteralGoodsdesc> iRequest) {
        // try {
        RequestParams params = new RequestParams();
        // params.add(PARAM_A, PARAM_GOODS);
        // params.add(PARAM_M, PARAM_INTEGRALGOODS);
        params.add(PARAM_EXID, exid);
        AddClient.post(INTEGRALDESCURL, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                try {
                    iRequest.request(JSON.parseObject(JSON.parseObject(content).getJSONObject(DATA)
                            .toJSONString(), InteralGoodsdesc.class));
                } catch (Exception e) {
                    iRequest.request(null);
                    e.printStackTrace();
                }
                super.onSuccess(statusCode, content);
            }

            @Override
            public void onFailure(Throwable error, String content) {
                iRequest.request(null);
                super.onFailure(error, content);
            }
        });
    }

    @Override
    public void getMyCollect(String uid, int page, int pageSize,
            final IRequest<List<Message>> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_ID, LEEPET_THREAD_API);
        params.add(PARAM_ACTION, "myfavorite");
        AddClient.get(BASEURL, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                try {
                    iRequest.request(JSON.parseArray(
                            JSON.parseObject(content).getJSONArray(RESPONSE_ARRAY).toJSONString(),
                            Message.class));
                } catch (Exception e) {
                    iRequest.request(null);
                }
            }
        });
    }

    @Override
    public void getMainDatas(String page, String pagesize, final IRequest<MainDatas> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_ID, LEEPET_THREAD_API);
        params.add(PARAM_ACTION, ACTION_INDEXRECOMMENDTHREAD);
        params.add(PARAM_PAGE, page);
        params.add(PARAM_PAGESIZE, pagesize);
        AddClient.get(BASEURL, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                try {
                    MainDatas parseObject = JSON.parseObject(content, MainDatas.class);
                    iRequest.request(parseObject);
                } catch (Exception e) {
                    iRequest.request(null);
                }
                super.onSuccess(statusCode, content);
            }

            @Override
            public void onFailure(Throwable error, String content) {
                iRequest.request(null);
                super.onFailure(error, content);
            }
        });
    }

    @Override
    public boolean joinGroup(String fid, final Context context, final IRequest<Boolean> iRequest) {
        try {
            RequestParams params = new RequestParams();
            params.add(PARAM_ID, LEEPET_THREAD_API);
            params.add(PARAM_ACTION, ACTION_GROUPJOIN);
            params.add(PARAM_FID, fid);
            AddClient.get(BASEURL, params, new AsyncHttpResponseHandler() {
                @Override
                public void onSuccess(int statusCode, String content) {
                    try {
                        BaseEntity parseObject = JSON.parseObject(content, BaseEntity.class);
                        if (null != parseObject) {
                            if (parseObject.getResult().equals("0")) {
                                if (null != parseObject.getMsg()
                                        && !TextUtils.isEmpty(parseObject.getMsg())) {
                                    Toast.makeText(context, parseObject.getMsg(),
                                            Toast.LENGTH_SHORT).show();
                                }
                                iRequest.request(true);
                            } else {
                                if (null != parseObject.getMsg()
                                        && !TextUtils.isEmpty(parseObject.getMsg())) {
                                    Toast.makeText(context, parseObject.getMsg(),
                                            Toast.LENGTH_SHORT).show();
                                }
                                iRequest.request(false);
                            }
                        }
                    } catch (Exception e) {
                        iRequest.request(false);
                    }
                    super.onSuccess(statusCode, content);
                }

                @Override
                public void onFailure(Throwable error, String content) {
                    iRequest.request(false);
                    super.onFailure(error, content);
                }
            });
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }
        return false;
    }

    @Override
    public boolean outGroup(String fid, final Context context, final IRequest<Boolean> iRequest) {
        try {
            RequestParams params = new RequestParams();
            params.add(PARAM_ID, LEEPET_THREAD_API);
            params.add(PARAM_ACTION, ACTION_GROUPOUT);
            params.add(PARAM_FID, fid);
            AddClient.get(BASEURL, params, new AsyncHttpResponseHandler() {
                @Override
                public void onSuccess(int statusCode, String content) {
                    try {
                        BaseEntity parseObject = JSON.parseObject(content, BaseEntity.class);
                        if (null != parseObject) {
                            if (parseObject.getResult().equals("0")) {
                                if (null != parseObject.getMsg()
                                        && !TextUtils.isEmpty(parseObject.getMsg())) {
                                    Toast.makeText(context, parseObject.getMsg(),
                                            Toast.LENGTH_SHORT).show();
                                }
                                iRequest.request(true);
                            } else {
                                if (null != parseObject.getMsg()
                                        && !TextUtils.isEmpty(parseObject.getMsg())) {
                                    Toast.makeText(context, parseObject.getMsg(),
                                            Toast.LENGTH_SHORT).show();
                                }
                                iRequest.request(false);
                            }
                        }
                    } catch (Exception e) {
                        iRequest.request(false);
                    }
                    super.onSuccess(statusCode, content);
                }

                @Override
                public void onFailure(Throwable error, String content) {
                    iRequest.request(false);
                    super.onFailure(error, content);
                }
            });
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }
        return false;
    }

    @Override
    public void getFollowFans(String uid, int page, int pageSize, final IRequest<Fans> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_ID, LEEPET_THREAD_API);
        params.add(PARAM_ACTION, ACTION_FOLLOWFANS);
        params.put("uid", UserState.getUserUid());
        params.put("page", String.valueOf(page));
        params.put("pagesize", String.valueOf(pageSize));
        AddClient.get(BASEURL, params, new AsyncHttpResponseHandler() {

            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                try {
                    iRequest.request(JSON.parseObject(content, Fans.class));

                } catch (Exception e) {
                    e.printStackTrace();
                    iRequest.request(null);
                }
            }
        });
    }

    @Override
    public void getNiuniuRecord(int pageFirst, int pageSize,
            final IRequest<List<NiuniuRecord>> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_ID, LEEPET_THREAD_API);
        params.add(PARAM_ACTION, "logcredit");
        params.add(PARAM_PAGE, String.valueOf(pageFirst));
        params.add(PARAM_PAGESIZE, String.valueOf(pageSize));
        AddClient.post(BASEURL, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                try {
                    iRequest.request(JSON.parseArray(
                            new JSONObject(content).getJSONArray(RESPONSE_ARRAY).toString(),
                            NiuniuRecord.class));
                } catch (Exception e) {
                    e.printStackTrace();
                    iRequest.request(null);
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });
    }

    @Override
    public void getFollowList(String uid, int page, int pageSize, String fid,
            final IRequest<Fans> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_ID, LEEPET_THREAD_API);
        params.add(PARAM_ACTION, ACTION_FOLLOWLIST);
        params.put("uid", UserState.getUserUid());
        params.put("page", String.valueOf(page));
        params.put("pagesize", String.valueOf(pageSize));

        if (!TextUtils.isEmpty(fid)) {
            params.put("fid", fid);
        }

        AddClient.get(BASEURL, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                try {
                    iRequest.request(JSON.parseObject(content, Fans.class));

                } catch (Exception e) {
                    e.printStackTrace();
                    iRequest.request(null);
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }

        });
    }

    @Override
    public void getGoodsRecord(int pageFirst, int pageSize,
            final IRequest<List<GoodsRecord>> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_PAGE, String.valueOf(pageFirst));
        params.add(PARAM_PAGESIZE, String.valueOf(10));
        // params.add("userID", CommonUtil.decode("1280593"));
        params.add("userID", CommonUtil.decode(UserState.getUser().uid));
        AddClient.post(USERINTEGRAL, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                try {
                    iRequest.request(JSON.parseArray(new JSONObject(content).getJSONArray(DATA)
                            .toString(), GoodsRecord.class));
                } catch (Exception e) {
                    iRequest.request(new ArrayList<GoodsRecord>());
                    e.printStackTrace();
                    // iRequest.request(null);
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });
    }

    @Override
    public void addIntegralGoods(String uid, String ex_id, String address_id,
            final IRequest<Pair<Boolean, String>> iRequest) {
        try {
            RequestParams params = new RequestParams();
            params.add(PARAM_ID, LEEPET_THREAD_API);
            params.add(PARAM_ACTION, ACTION_GROUPOUT);
            params.add(PARAM_USERID, uid);
            params.add(PARAM_EXID, ex_id);
            params.add(PARAM_ADDRESS_ID, address_id);
            AddClient.post(ADDUSERINTEGRAL, params, new AsyncHttpResponseHandler() {
                @Override
                public void onSuccess(int statusCode, String content) {
                    super.onSuccess(statusCode, content);
                    try {
                        iRequest.request(new Pair<Boolean, String>(JSON.parseObject(content)
                                .getInteger(STATUS) == 1 ? true : false, JSON.parseObject(content)
                                .getString("msg")));
                    } catch (Exception e) {
                        e.printStackTrace();
                        iRequest.request(null);
                    }
                }

                @Override
                public void onFailure(Throwable error, String content) {
                    super.onFailure(error, content);
                    iRequest.request(null);
                }
            });
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Override
    public void getBangDatas(String page, String pagesize, final IRequest<MainDatas> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_ID, LEEPET_THREAD_API);
        params.add(PARAM_ACTION, ACTION_INDEXRECOMMENDTHREAD);
        params.add(PARAM_TYPE, PARAM_BANG);
        params.add(PARAM_PAGE, page);
        params.add(PARAM_PAGESIZE, pagesize);
        AddClient.get(BASEURL, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                try {
                    MainDatas parseObject = JSON.parseObject(content, MainDatas.class);
                    iRequest.request(parseObject);
                } catch (Exception e) {
                    iRequest.request(null);
                }
                super.onSuccess(statusCode, content);
            }

            @Override
            public void onFailure(Throwable error, String content) {
                iRequest.request(null);
                super.onFailure(error, content);
            }
        });
    }

    @Override
    public void getDaYenDatas(String page, String pagesie, String type,
            final IRequest<Dayens> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_ID, LEEPET_THREAD_API);
        params.add(PARAM_ACTION, ACTION_INDEXRECOMMENDDAREN);
        params.add(PARAM_TYPE, type);
        params.add(PARAM_PAGE, page);
        params.add(PARAM_PAGESIZE, pagesie);
        AddClient.get(BASEURL, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                try {
                    Dayens parseObject = JSON.parseObject(content, Dayens.class);
                    iRequest.request(parseObject);
                } catch (Exception e) {
                    iRequest.request(null);
                }
                super.onSuccess(statusCode, content);
            }

            @Override
            public void onFailure(Throwable error, String content) {
                iRequest.request(null);
                super.onFailure(error, content);
            }
        });
    }

    @Override
    public void deleteIntegral(String goodsid, String need,
            final IRequest<Pair<Boolean, String>> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_NEED, need);
        params.add("goodsid", goodsid);
        params.add(PARAM_ID, LEEPET_THREAD_API);
        params.add(PARAM_ACTION, ACTION_CREDITDUIHUAN);
        XDHttpClient.post2(BASEURL, params, new AsyncHttpResponseHandler() {

            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                try {
                    String niuniu = JSON.parseObject(content).getString("niuniu");
                    if (niuniu != null) {
                        User user = UserState.getUser();
                        user.niuniu = niuniu;
                        UserState.setUser(user);
                    }
                    iRequest.request(new Pair<Boolean, String>(JSON.parseObject(content)
                            .getInteger(RESULT) == 0 ? true : false, JSON.parseObject(content)
                            .getString("msg")));
                } catch (Exception e) {
                    e.printStackTrace();
                    iRequest.request(null);
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                iRequest.request(null);
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });
    }

    @Override
    public void goToSign(final IRequest<Pair<Boolean, String>> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_ID, LEEPET_THREAD_API);
        params.add(PARAM_ACTION, ACTION_LOGINSIGN);
        XDHttpClient.post2(BASEURL, params, new AsyncHttpResponseHandler() {

            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                try {
                    iRequest.request(new Pair<Boolean, String>(JSON.parseObject(content)
                            .getInteger(RESULT) == 0 ? true : false, JSON.parseObject(content)
                            .getString("niuniu")));
                } catch (Exception e) {
                    e.printStackTrace();
                    iRequest.request(null);
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });
    }

    @Override
    public void getHomeRecommendGroups(final IRequest<Groups> iRequest) {
        try {
            RequestParams params = new RequestParams();
            params.add(PARAM_ID, LEEPET_THREAD_API);
            params.add(PARAM_ACTION, ACTION_GROUPRECOMMENDLIST);
            // 添加一个参数,用于获取 免费试用
            params.add("ver", "1.4");
            AddClient.get(BASEURL, params, new AsyncHttpResponseHandler() {
                @Override
                public void onSuccess(int statusCode, String content) {
                    try {
                        Groups parseObject = JSON.parseObject(content, Groups.class);
                        iRequest.request(parseObject);
                    } catch (Exception e) {
                        iRequest.request(null);
                        e.printStackTrace();
                    }
                    super.onSuccess(statusCode, content);
                }

                @Override
                public void onFailure(Throwable error, String content) {
                    iRequest.request(null);
                    super.onFailure(error, content);
                }
            });
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Override
    public void getClubDetail(String fid, final IRequest<PostListEntity2> iRequest) {

        // TODO Auto-generated method stub


        try {
            String url =
                    "http://bbs.chinapet.com/plugin.php?id=leepet_thread:api&action=threadlist&page=1&pagesize=10&fid=";
            url += fid;

            RequestParams params = new RequestParams();
            // params.add("page", "1");
            // params.add("pagesize", "10");
            // params.add("action", "threadlist");
            // params.add("fid", fid);
            // http://bbs.chinapet.com/plugin.php?id=leepet_thread:api&action=threadlist&fid=47&page=1&pagesize=10
            // AddClient.get("http://bbs.chinapet.com/plugin.php?id=leepet_thread:api", params,
            AddClient.get(url, params, new AsyncHttpResponseHandler() {
                @Override
                public void onSuccess(int statusCode, String content) {

                    // PostListEntity parseObject =
                    // JSON.parseObject(content, PostListEntity.class);


                    PostListEntity2 parseObject = new PostListEntity2();

                    ForumInfo info = new ForumInfo();

                    JSONObject object = null;

                    JSONArray array = null;
                    JSONArray array2 = null;

                    List<Banzhu> banzhuList = new ArrayList<Banzhu>();
                    List<Banzhu> darenList = new ArrayList<Banzhu>();

                    try {
                        object = new JSONObject(content);
                        JSONObject object2 = object.getJSONObject("foruminfo");
                        array = object2.getJSONArray("banzhuarray");
                        array2 = object2.getJSONArray("darenarray");
                        Banzhu ban;
                        for (int i = 0; i < array.length(); i++) {

                            JSONObject temp = (JSONObject) array.get(i);
                            String id = temp.getString("uid");
                            String name = temp.getString("username");
                            String face = temp.getString("userface");
                            ban = new Banzhu(id, name, face);

                            banzhuList.add(ban);
                        }

                        for (int i = 0; i < array2.length(); i++) {

                            JSONObject temp = (JSONObject) array2.get(i);
                            String id = temp.getString("uid");
                            String name = temp.getString("username");
                            String face = temp.getString("userface");
                            ban = new Banzhu(id, name, face);

                            darenList.add(ban);
                        }

                        info.banzhuarray = banzhuList;
                        info.darenarray = darenList;
                        info.description = object2.getString("description");
                        info.posts = object2.getString("posts");
                        info.name = object2.getString("name");
                        info.membernum = object2.getString("membernum");
                        info.isjoin = object2.getString("isjoin");
                        info.apprules = object2.getString("apprules");
                        info.ico = object2.getString("ico");
                        info.fid = object2.getString("fid");
                        info.moderators = object2.getString("moderators");


                        parseObject.foruminfo = info;
                        List<Post> posts = new ArrayList<Post>();
                        parseObject.array = posts;
                        parseObject.total = object.getString("total");


                        iRequest.request(parseObject);

                    } catch (Exception e) {
                        iRequest.request(null);
                        e.printStackTrace();
                    }


                }

                @Override
                public void onFailure(Throwable error, String content) {
                    iRequest.request(null);
                    super.onFailure(error, content);
                }
            });
        } catch (Exception e) {
            e.printStackTrace();
        }


    }

    @Override
    public void shareSend(String come, String type, String tid,
            final IRequest<KeyValuePair<Integer, String>> iRequest) {
        try {
            RequestParams params = new RequestParams();
            params.add(PARAM_ID, LEEPET_THREAD_API);
            // params.add(PARAM_ID, LEEPET_THREAD_SHARESEND);
            // params.add(PARAM_UID, CommonParameter.UserState.getUserUid());

            params.add(PARAM_ACTION, ACTION_SHARE_SEND);
            params.add(PARAM_COME, come);
            params.add(PARAM_TYPE, type);
            params.add(PARAM_TID, tid);
            AddClient.get(BASEURL, params, new AsyncHttpResponseHandler() {
                @Override
                public void onSuccess(int statusCode, String content) {
                    super.onSuccess(statusCode, content);
                    try {
                        iRequest.request(new KeyValuePair<Integer, String>(Integer.parseInt(JSON
                                .parseObject(content).getString("result")), JSON.parseObject(
                                content).getString("jifentishi")));
                    } catch (Exception e) {
                        iRequest.request(null);
                        e.printStackTrace();
                    }
                }

                @Override
                public void onFailure(Throwable error, String content) {
                    iRequest.request(null);
                    super.onFailure(error, content);
                }
            });
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Override
    public void getQiandaoRecord(int pageFirst, int pageSize, final IRequest<QiandaoRecord> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_ID, LEEPET_THREAD_API);
        params.add(PARAM_PAGE, String.valueOf(pageFirst));
        params.add(PARAM_PAGESIZE, String.valueOf(pageSize));
        params.add(PARAM_ACTION, "signlog");
        AddClient.post(BASEURL, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                try {
                    QiandaoRecord qiandao = JSON.parseObject(content, QiandaoRecord.class);
                    iRequest.request(qiandao);
                } catch (Exception e) {
                    e.printStackTrace();
                    iRequest.request(null);
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });
    }

    @Override
    public void getExchangeResult(String ex_id, String address_id,
            final IRequest<ExchangeResult> iRequest) {
        // TODO Auto-generated method stub
        RequestParams params = new RequestParams();
        params.add(PARAM_ID, LEEPET_THREAD_API);
        params.add(PARAM_ACTION, ACTION_CREDITDUIHUAN);
        params.add(PARAMS_GOODSID, ex_id);
        params.add(PARAM_ADDRESS_ID, address_id);
        AddClient.post(BASEURL, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                try {
                    ExchangeResult result = JSON.parseObject(content, ExchangeResult.class);
                    iRequest.request(result);
                } catch (Exception e) {
                    e.printStackTrace();
                    iRequest.request(null);
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });

    }

    @Override
    public void getQuxiaoExchangeResult(String integral_id, final IRequest<ExchangeResult> iRequest) {
        // TODO Auto-generated method stub
        RequestParams params = new RequestParams();
        params.add(PARAM_ID, LEEPET_THREAD_API);
        params.add(PARAM_ACTION, ACTION_SHOPQUXIAO);
        params.add(PARAMS_INTEGRALID, integral_id);
        AddClient.post(BASEURL, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                try {
                    ExchangeResult result = JSON.parseObject(content, ExchangeResult.class);
                    iRequest.request(result);
                } catch (Exception e) {
                    e.printStackTrace();
                    iRequest.request(null);
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });


    }

    @Override
    public void getFreeUseListDataResult(String page, String pageSize,
            final IRequest<List<FreeUseListData>> iRequest) {
        // TODO Auto-generated method stub
        RequestParams params = new RequestParams();
        params.add(PARAM_ID, LEEPET_THREAD_API);
        params.add(PARAM_ACTION, ACTION_FREEUSE);
        params.add(PARAM_PAGE, page);
        params.add(PARAM_PAGESIZE, pageSize);
        AddClient.post(BASEURL, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                try {

                    iRequest.request(JSON.parseArray(JSON.parseObject(content).getJSONArray(ARRAY)
                            .toJSONString(), FreeUseListData.class));

                } catch (Exception e) {
                    e.printStackTrace();
                    iRequest.request(null);
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });

    }

    @Override
    public void getShareToWeiba(String uidlist, String tid, String content,
            final IRequest<ShareToWeibaResult> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_ID, LEEPET_THREAD_API);
        params.add(PARAM_ACTION, ACTION_SHAREZHANNEI);
        params.add(PARAM_UIDLIST, uidlist);
        params.add(PARAM_TID, tid);
        params.add(PARAM_CONTENT, content);
        AddClient.post(BASEURL, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                try {

                    iRequest.request(JSON.parseObject(content, ShareToWeibaResult.class));

                } catch (Exception e) {
                    e.printStackTrace();
                    iRequest.request(null);
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });

    }

    @Override
    public void activityApply(String tid, String realname, String address, String mobile,
            String message, final IRequest<BaseEntity> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_ID, LEEPET_THREAD_API);
        params.add(PARAM_ACTION, ACTION_ACTIVITY_APPLY);
        params.add(PARAM_TID, tid);
        params.add("realname", realname);
        params.add("address", address);
        params.add("mobile", mobile);
        params.add("message", message);
        AddClient.post(BASEURL, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                System.out.println(content);
                try {
                    iRequest.request(JSON.parseObject(content, BaseEntity.class));
                } catch (Exception e) {
                    e.printStackTrace();
                    iRequest.request(null);
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });
    }

    @Override
    public void getRequestCodeInfo(String requestCode, final IRequest<BaseEntity> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_ID, LEEPET_THREAD_API);
        params.add(PARAM_ACTION, ACTION_REQUESTCODE);
        params.add("code", requestCode);
        AddClient.post(BASEURL, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                System.out.println(content);
                try {
                    iRequest.request(JSON.parseObject(content, BaseEntity.class));
                } catch (Exception e) {
                    e.printStackTrace();
                    iRequest.request(null);
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });
    }

    @Override
    public void getInviteInfo(final IRequest<InviteInfo> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_ID, LEEPET_THREAD_API);
        params.add(PARAM_ACTION, ACTION_INVITEINFO);
        AddClient.post(BASEURL, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                System.out.println(content);
                try {
                    iRequest.request(JSON.parseObject(content, InviteInfo.class));
                } catch (Exception e) {
                    e.printStackTrace();
                    iRequest.request(null);
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });
    }

    @Override
    public void getRequestFriends(final IRequest<MyRequestFriend> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_ID, LEEPET_THREAD_API);
        params.add(PARAM_ACTION, ACTION_MYFRIEND);
        AddClient.post(BASEURL, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                System.out.println(content);
                try {
                    iRequest.request(JSON.parseObject(content, MyRequestFriend.class));
                } catch (Exception e) {
                    e.printStackTrace();
                    iRequest.request(null);
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });
    }

    @Override
    public void getShopBanners(String positionId, final IRequest<List<HomeBanner>> iRequest) {
        RequestParams params = new RequestParams();
        params.add("a", "goods");
        params.add("m", "banner");
        params.add("positionId", positionId);
        AddClient.post(SHOPURL, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                System.out.println(content);
                try {
                    iRequest.request(JSON.parseArray(JSON.parseObject(content).getJSONArray("data")
                            .toString(), HomeBanner.class));
                } catch (Exception e) {
                    e.printStackTrace();
                    iRequest.request(null);
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });
    }

    @Override
    public void getSecondClasses(String parentID, final IRequest<SecondClass> iRequest) {
        RequestParams params = new RequestParams();
        params.add("a", "goods");
        params.add("m", "category");
        params.add("parentID", parentID);
        AddClient.post(SHOPURL, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                System.out.println(content);
                try {
                    iRequest.request(JSON.parseObject(content, SecondClass.class));
                } catch (Exception e) {
                    e.printStackTrace();
                    iRequest.request(null);
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });
    }

    @Override
    public void getNewGoods(final IRequest<List<Product>> iRequest) {
        RequestParams params = new RequestParams();
        params.add("a", "goods");
        params.add("m", "newGoods");
        AddClient.post(SHOPURL, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                System.out.println(content);
                try {
                    iRequest.request(JSON.parseArray(JSON.parseObject(content)
                            .getJSONObject("data").getJSONArray("info").toString(), Product.class));
                } catch (Exception e) {
                    e.printStackTrace();
                    iRequest.request(null);
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });
    }

    @Override
    public void getBrandInfo(final IRequest<BrandBean> iRequest) {
        RequestParams params = new RequestParams();
        params.add("a", "goods");
        params.add("m", "brand");
        AddClient.post(SHOPURL, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                System.out.println(content);
                try {
                    iRequest.request(JSON.parseObject(content, BrandBean.class));
                } catch (Exception e) {
                    e.printStackTrace();
                    iRequest.request(null);
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });
    }

    @Override
    public void getShopDetail(String goodsID, String userID, final IRequest<Product> iRequest) {
        RequestParams params = new RequestParams();
        params.add("a", "goods");
        params.add("m", "goodsDetail");
        params.add("goodsID", goodsID);
        params.add("userID", userID);
        AddClient.post(SHOPURL, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                System.out.println(content);
                try {
                    iRequest.request(JSON.parseObject(
                            JSON.parseObject(content).getJSONObject("data").toString(),
                            Product.class));
                } catch (Exception e) {
                    e.printStackTrace();
                    iRequest.request(null);
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });
    }

    @Override
    public void getShopDetailInfo(String goodsID, final IRequest<GoodsInfos> iRequest) {
        RequestParams params = new RequestParams();
        params.add("a", "goods");
        params.add("m", "goodsInfo");
        params.add("goodsID", goodsID);
        AddClient.post(SHOPURL, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                System.out.println(content);
                try {
                    iRequest.request(JSON.parseObject(content, GoodsInfos.class));
                } catch (Exception e) {
                    e.printStackTrace();
                    iRequest.request(null);
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });
    }

    @Override
    public void getShopDetailStandardInfo() {}

    @Override
    public void getShopDetailComment(String goodsID, int type, int page, int pageSize,
            final IRequest<CommentInfos> iRequest) {
        RequestParams params = new RequestParams();
        params.add("a", "goods");
        params.add("m", "commentList");
        params.add("goodsID", goodsID);
        params.add("type", String.valueOf(type));
        params.add("page", String.valueOf(page));
        params.add("pageSize", String.valueOf(pageSize));
        AddClient.post(SHOPURL, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                System.out.println(content);
                try {
                    iRequest.request(JSON.parseObject(content, CommentInfos.class));
                } catch (Exception e) {
                    e.printStackTrace();
                    iRequest.request(null);
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });
    }

    @Override
    public void getGoodsListInfo(String page, String pageSize, String brandID, String catID,
            final IRequest<GoodsListInfo> iRequest) {
        // TODO Auto-generated method stub
        RequestParams params = new RequestParams();
        params.add(PARAM_PAGE, page);
        params.add(PARAM_PAGESIZE, pageSize);
        if (!brandID.equals("")) {
            params.add("brandID", brandID);
        }
        if (!catID.equals("")) {
            params.add("catID", catID);
        }
        AddClient.get("http://ts.leepet.com/plugins/API.v1.0/?&a=goods&m=goodsList", params,
                new AsyncHttpResponseHandler() {
                    @Override
                    public void onSuccess(int statusCode, String content) {
                        super.onSuccess(statusCode, content);
                        try {
                            iRequest.request(JSON.parseObject(content, GoodsListInfo.class));
                        } catch (Exception e) {
                            e.printStackTrace();
                            iRequest.request(null);
                        }
                    }

                    @Override
                    public void onFailure(Throwable error, String content) {
                        super.onFailure(error, content);
                        iRequest.request(null);
                    }
                });


    }

    @Override
    public void getMainZuixinData(int page, int pageSize, final IRequest<MainZuixinData> iRequest) {
        // TODO Auto-generated method stub
        RequestParams params = new RequestParams();
        params.add(PARAM_PAGE, String.valueOf(page));
        params.add(PARAM_PAGESIZE, String.valueOf(pageSize));

        AddClient
                .get("http://bbs.chinapet.com/plugin.php?id=leepet_thread:api&action=threadlist&filter=lastpost",
                        params, new AsyncHttpResponseHandler() {
                            @Override
                            public void onSuccess(int statusCode, String content) {
                                super.onSuccess(statusCode, content);
                                try {
                                    iRequest.request(JSON
                                            .parseObject(content, MainZuixinData.class));
                                } catch (Exception e) {
                                    e.printStackTrace();
                                    iRequest.request(null);
                                }
                            }

                            @Override
                            public void onFailure(Throwable error, String content) {
                                super.onFailure(error, content);
                                iRequest.request(null);
                            }
                        });
    }

    @Override
    public void praise(String tid, String uid, final IRequest<RecommendInfo> iRequest) {
        RequestParams params = new RequestParams();
        params.put("tid", tid);
        params.put("uid", UserState.getUserUid());
        XDHttpClient.get(xdConfig.PRAISEPOST, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                try {
                    if (new JSONObject(content).getInt("result") == 0) {
                        RecommendInfo info = new RecommendInfo();
                        info.setUserface(UserState.getUser().userface);
                        iRequest.request(info);
                    } else {
                        iRequest.request(null);
                    }
                } catch (JSONException e1) {
                    e1.printStackTrace();
                }
            }

            @Override
            public void onFailure(Throwable arg0, String arg1) {
                super.onFailure(arg0, arg1);
                iRequest.request(null);
            }
        });
    }

    @Override
    public void getComments(String pid, int page, int pagesize,
            final IRequest<PostCommentInfos> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_ID, LEEPET_THREAD_API);
        params.add(PARAM_ACTION, "commentmore");
        params.put("pid", pid);
        params.put("page", String.valueOf(page));
        params.put("pagesize", String.valueOf(pagesize));
        XDHttpClient.get(xdConfig.PRAISEPOST, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                try {
                    iRequest.request(JSON.parseObject(content, PostCommentInfos.class));
                } catch (Exception e) {
                    iRequest.request(null);
                }
            }

            @Override
            public void onFailure(Throwable arg0, String arg1) {
                super.onFailure(arg0, arg1);
                iRequest.request(null);
            }
        });
    }

    @Override
    public void commentLayer(String tid, String pid, String content, String touid,
            final IRequest<BaseEntity> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_ID, LEEPET_THREAD_API);
        params.add(PARAM_ACTION, "postcomment");
        params.put("tid", tid);
        params.put("pid", pid);
        params.put("content", content);
        params.put("touid", touid);
        XDHttpClient.get(xdConfig.PRAISEPOST, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                System.out.println(content);
                try {
                    iRequest.request(JSON.parseObject(content, BaseEntity.class));
                } catch (Exception e) {
                    iRequest.request(null);
                }
            }

            @Override
            public void onFailure(Throwable arg0, String arg1) {
                super.onFailure(arg0, arg1);
                iRequest.request(null);
            }
        });
    }

    @Override
    public void getZanListData(String tid, int page, int pagesize,
            final IRequest<ZanListData> iRequest) {
        // TODO Auto-generated method stub
        RequestParams params = new RequestParams();
        params.add(PARAM_PAGE, String.valueOf(page));
        params.add(PARAM_PAGESIZE, String.valueOf(pagesize));
        params.add(PARAM_TID, tid);

        AddClient.get(
                "http://bbs.chinapet.com/plugin.php?id=leepet_thread:api&action=recommenduserlist",
                params, new AsyncHttpResponseHandler() {
                    @Override
                    public void onSuccess(int statusCode, String content) {
                        super.onSuccess(statusCode, content);
                        try {
                            iRequest.request(JSON.parseObject(content, ZanListData.class));
                        } catch (Exception e) {
                            e.printStackTrace();
                            iRequest.request(null);
                        }
                    }

                    @Override
                    public void onFailure(Throwable error, String content) {
                        super.onFailure(error, content);
                        iRequest.request(null);
                    }
                });
    }

    @Override
    public void getMainFriendData(int page, int pageSize, final IRequest<MainZuixinData> iRequest) {
        // TODO Auto-generated method stub
        RequestParams params = new RequestParams();
        params.add(PARAM_PAGE, String.valueOf(page));
        params.add(PARAM_PAGESIZE, String.valueOf(pageSize));

        AddClient
                .get("http://bbs.chinapet.com/plugin.php?id=leepet_thread:api&action=threadlist&filter=follow",
                        params, new AsyncHttpResponseHandler() {
                            @Override
                            public void onSuccess(int statusCode, String content) {
                                super.onSuccess(statusCode, content);
                                try {
                                    iRequest.request(JSON
                                            .parseObject(content, MainZuixinData.class));
                                } catch (Exception e) {
                                    e.printStackTrace();
                                    iRequest.request(null);
                                }
                            }

                            @Override
                            public void onFailure(Throwable error, String content) {
                                super.onFailure(error, content);
                                iRequest.request(null);
                            }
                        });

    }

    @Override
    public void getNearPicList(int page, int pageSize, final IRequest<NearPictureBean> iRequest) {
        RequestParams params = new RequestParams();
        params.add("page", String.valueOf(page));
        params.add("pageSize", String.valueOf(pageSize));
        // http://bbs.chinapet.com/plugin.php?id=leepet_thread:api&action=shaitulist
        AddClient.get(BASEURL + ACTION_NEARPICTURE, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                try {
                    iRequest.request(JSON.parseObject(content, NearPictureBean.class));
                } catch (Exception e) {
                    e.printStackTrace();
                    iRequest.request(null);
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });

    }

    @Override
    public void getMyJoinActivity(int page, int pageSize, final IRequest<NearPictureBean> iRequest) {
        RequestParams params = new RequestParams();
        params.add("page", String.valueOf(page));
        params.add("pageSize", String.valueOf(pageSize));
        // http://bbs.chinapet.com/plugin.php?id=leepet_thread:api&action=shaitulist
        AddClient.get(BASEURL + ACTION_MYJOINACTIVITY, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                try {
                    iRequest.request(JSON.parseObject(content, NearPictureBean.class));
                } catch (Exception e) {
                    e.printStackTrace();
                    iRequest.request(null);
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });

    }

    @Override
    public void getSplashPictureData(int page, int pageSize, String actid, String filter,
            final IRequest<SplashPictureBean> iRequest) {
        RequestParams params = new RequestParams();
        params.add("page", String.valueOf(page));
        params.add("pageSize", String.valueOf(pageSize));
        params.add("actid", actid);
        params.add("filter", filter);

        AddClient.get(BASEURL + ACTION_SPLASHPICTURE, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                System.out.println(content);
                try {
                    iRequest.request(JSON.parseObject(content, SplashPictureBean.class));
                } catch (Exception e) {
                    e.printStackTrace();
                    iRequest.request(null);
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });

    }

    @Override
    public void getNearByInfo(final IRequest<List<NearByInfo>> iRequest) {
        AddClient.get(BASEURL + ACTION_NEARBYBANNER, null, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                try {
                    iRequest.request(JSON.parseArray(JSON.parseObject(content)
                            .getJSONArray("array").toString(), NearByInfo.class));
                } catch (Exception e) {
                    e.printStackTrace();
                    iRequest.request(null);
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });

    }

    @Override
    public void getActivityBannerData(String tid, final IRequest<PostLandlordInfos> iRequest) {
        RequestParams params = new RequestParams();
        params.add("tid", tid);
        AddClient.get(BASEURL + ACTION_ACTIVITYBANNER, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                try {
                    iRequest.request(JSON.parseObject(content, PostLandlordInfos.class));
                } catch (Exception e) {
                    e.printStackTrace();
                    iRequest.request(null);
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });

    }

    @Override
    public void getRecommendCicleData(final IRequest<RecommendCicleData> iRequest) {
        // TODO Auto-generated method stub
        RequestParams params = new RequestParams();
        params.add(PARAM_ID, LEEPET_THREAD_API);
        params.add(PARAM_ACTION, ACTION_RECOMMEND_CICLE);
        AddClient.get(BASEURL, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                try {
                    iRequest.request(JSON.parseObject(content, RecommendCicleData.class));
                } catch (Exception e) {
                    e.printStackTrace();
                    iRequest.request(null);
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });
    }


    @Override
    public void getMyPetList(String uid, final IRequest<PetInfo> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_ID, LEEPET_THREAD_API);
        params.add(PARAM_ACTION, "mypetlist");
        params.add(PARAM_UID, uid);
        AddClient.get(BASEURL, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                try {
                    iRequest.request(JSON.parseObject(content, PetInfo.class));
                } catch (Exception e) {
                    e.printStackTrace();
                    iRequest.request(null);
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });

    }



    @Override
    public void getMyTags(final IRequest<TagInfos> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_ID, LEEPET_THREAD_API);
        params.add(PARAM_ACTION, "indexpostconfig");
        AddClient.get(BASEURL, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                try {
                    iRequest.request(JSON.parseObject(content, TagInfos.class));
                } catch (Exception e) {
                    e.printStackTrace();
                    iRequest.request(null);
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });
    }

    @Override
    public void getPostImgData(String tid, final IRequest<PostImgData> iRequest) {
        // TODO Auto-generated method stub
        RequestParams params = new RequestParams();
        params.add(PARAM_ID, LEEPET_THREAD_API);
        params.add(PARAM_ACTION, ACTION_THREADSHOWIMG);
        params.add(PARAM_TID, tid);
        params.add(PARAM_ISDESC, "0");
        AddClient.get(BASEURL, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                try {
                    iRequest.request(JSON.parseObject(content, PostImgData.class));
                } catch (Exception e) {
                    e.printStackTrace();
                    iRequest.request(null);
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });
    }

    @Override
    public void collect(String tid, String uid, final IRequest<BaseEntity> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_ID, LEEPET_THREAD_API);
        params.add(PARAM_ACTION, "favoriteOnePost");
        params.add(PARAM_UID, uid);
        params.add(PARAM_TID, tid);
        AddClient.get(BASEURL, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                try {
                    iRequest.request(JSON.parseObject(content, BaseEntity.class));
                } catch (Exception e) {
                    e.printStackTrace();
                    iRequest.request(null);
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });

    }

    @Override
    public void cancelCollect(String tid, String uid, final IRequest<BaseEntity> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_ID, LEEPET_THREAD_API);
        params.add(PARAM_ACTION, "myfavoritecancel");
        params.add(PARAM_UID, uid);
        params.add(PARAM_TID, tid);
        AddClient.get(BASEURL, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                try {
                    iRequest.request(JSON.parseObject(content, BaseEntity.class));
                } catch (Exception e) {
                    e.printStackTrace();
                    iRequest.request(null);
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });
    }

    @Override
    public void report(String tid, String uid, String pid, final IRequest<BaseEntity> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_ID, LEEPET_THREAD_API);
        params.add(PARAM_ACTION, "reportOnePost");
        // params.add(PARAM_UID, uid);
        params.add(PARAM_TID, tid);
        // params.add("pid", pid);
        AddClient.get(BASEURL, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                try {
                    iRequest.request(JSON.parseObject(content, BaseEntity.class));
                } catch (Exception e) {
                    e.printStackTrace();
                    iRequest.request(null);
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });
    }

    @Override
    public void getTagListData(String tagid, int page, int pageSize,
            final IRequest<MainZuixinData> iRequest) {
        // TODO Auto-generated method stub
        RequestParams params = new RequestParams();
        params.add(PARAM_ID, LEEPET_THREAD_API);
        params.add(PARAM_ACTION, ACTION_THREADLISTBYTAGID);
        params.add(PARAM_PAGE, String.valueOf(page));
        params.add(PARAM_PAGESIZE, String.valueOf(pageSize));
        params.add(PARAM_TAGID, tagid);
        AddClient.get(BASEURL, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                try {
                    iRequest.request(JSON.parseObject(content, MainZuixinData.class));
                } catch (Exception e) {
                    e.printStackTrace();
                    iRequest.request(null);
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });
    }


    @Override
    public void getMyReplyInfos(int page, int pageSize, final IRequest<MyReplyInfos> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_ID, LEEPET_THREAD_API);
        params.add(PARAM_ACTION, "mypost");
        params.add("page", String.valueOf(page));
        params.add("pagesize", String.valueOf(pageSize));
        AddClient.get(BASEURL + ACTION_NEARPICTURE, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                try {
                    iRequest.request(JSON.parseObject(content, MyReplyInfos.class));
                } catch (Exception e) {
                    e.printStackTrace();
                    iRequest.request(null);
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });
    }

    @Override
    public void getDeleteAddressInfo(String userID, String addressID,
            final IRequest<BaseEntity> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_USERID, userID);
        params.add("addressID", addressID);
        AddClient.get(ACTION_DELETEADDRESS, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                try {
                    iRequest.request(JSON.parseObject(content, BaseEntity.class));
                } catch (Exception e) {
                    e.printStackTrace();
                    iRequest.request(null);
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });
    }

    @Override
    public void fengHaoOrJinYan(boolean isFenghao, String toUserID,
            final IRequest<BaseEntity> iRequest) {
        RequestParams params = new RequestParams();
        if (isFenghao) {
            params.add(PARAM_TYPE, "");
        } else {
            params.add(PARAM_TYPE, "post");
        }
        params.add(PARAM_TOUID, toUserID);
        AddClient.post("http://bbs.chinapet.com/plugin.php?id=leepet_thread:api&action=banuser",
                params, new AsyncHttpResponseHandler() {
                    @Override
                    public void onSuccess(int statusCode, String content) {
                        super.onSuccess(statusCode, content);
                        try {
                            iRequest.request(JSON.parseObject(content, BaseEntity.class));
                        } catch (Exception e) {
                            e.printStackTrace();
                            iRequest.request(null);
                        }
                    }

                    @Override
                    public void onFailure(Throwable error, String content) {
                        super.onFailure(error, content);
                        iRequest.request(null);
                    }
                });
    }


    @Override
    public void cancelPraise(String tid, final IRequest<BaseEntity> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_TID, tid);
        AddClient
                .get("http://bbs.chinapet.com/plugin.php?id=leepet_thread:api&action=praisePost&iscancel=1",
                        params, new AsyncHttpResponseHandler() {
                            @Override
                            public void onSuccess(int statusCode, String content) {
                                super.onSuccess(statusCode, content);
                                try {
                                    iRequest.request(JSON.parseObject(content, BaseEntity.class));
                                } catch (Exception e) {
                                    e.printStackTrace();
                                    iRequest.request(null);
                                }
                            }

                            @Override
                            public void onFailure(Throwable error, String content) {
                                super.onFailure(error, content);
                                iRequest.request(null);
                            }
                        });
    }

    @Override
    public void addJing(String tid, final IRequest<BaseEntity> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_TID, tid);
        AddClient
                .get("http://bbs.chinapet.com/plugin.php?id=leepet_thread:api&action=topicadmin&op=digest",
                        params, new AsyncHttpResponseHandler() {
                            @Override
                            public void onSuccess(int statusCode, String content) {
                                super.onSuccess(statusCode, content);
                                try {
                                    iRequest.request(JSON.parseObject(content, BaseEntity.class));
                                } catch (Exception e) {
                                    e.printStackTrace();
                                    iRequest.request(null);
                                }
                            }

                            @Override
                            public void onFailure(Throwable error, String content) {
                                super.onFailure(error, content);
                                iRequest.request(null);
                            }
                        });
    }

    @Override
    public void deletePost(String tid, final IRequest<BaseEntity> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_TID, tid);
        AddClient
                .get("http://bbs.chinapet.com/plugin.php?id=leepet_thread:api&action=topicadmin&op=delthread",
                        params, new AsyncHttpResponseHandler() {
                            @Override
                            public void onSuccess(int statusCode, String content) {
                                super.onSuccess(statusCode, content);
                                try {
                                    iRequest.request(JSON.parseObject(content, BaseEntity.class));
                                } catch (Exception e) {
                                    e.printStackTrace();
                                    iRequest.request(null);
                                }
                            }

                            @Override
                            public void onFailure(Throwable error, String content) {
                                super.onFailure(error, content);
                                iRequest.request(null);
                            }
                        });
    }

    @Override
    public void daShang(String tid, String pid, String reason, String score,
            final IRequest<BaseEntity> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_TID, tid);
        params.add(PARAM_PID, pid);
        params.add(PARAM_REASON, reason);
        params.add(PARAM_SCORE, score);
        AddClient
                .post("http://bbs.chinapet.com/plugin.php?id=leepet_thread:api&action=topicadmin&op=ratesubmit",
                        params, new AsyncHttpResponseHandler() {
                            @Override
                            public void onSuccess(int statusCode, String content) {
                                super.onSuccess(statusCode, content);
                                try {
                                    iRequest.request(JSON.parseObject(content, BaseEntity.class));
                                } catch (Exception e) {
                                    e.printStackTrace();
                                    iRequest.request(null);
                                }
                            }

                            @Override
                            public void onFailure(Throwable error, String content) {
                                super.onFailure(error, content);
                                iRequest.request(null);
                            }
                        });
    }

    @Override
    public void deleteReply(String tid, String pid, final IRequest<BaseEntity> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_TID, tid);
        params.add(PARAM_PID, pid);
        AddClient
                .post("http://bbs.chinapet.com/plugin.php?id=leepet_thread:api&action=topicadmin&op=delpost",
                        params, new AsyncHttpResponseHandler() {
                            @Override
                            public void onSuccess(int statusCode, String content) {
                                super.onSuccess(statusCode, content);
                                try {
                                    iRequest.request(JSON.parseObject(content, BaseEntity.class));
                                } catch (Exception e) {
                                    e.printStackTrace();
                                    iRequest.request(null);
                                }
                            }

                            @Override
                            public void onFailure(Throwable error, String content) {
                                super.onFailure(error, content);
                                iRequest.request(null);
                            }
                        });
    }

    @Override
    public void getRankingList(int page, int pageSize, final IRequest<BaseEntity> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_PAGE, String.valueOf(page));
        params.add(PARAM_PAGESIZE, String.valueOf(pageSize));
        AddClient.post("", params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                try {
                    iRequest.request(JSON.parseObject(content, BaseEntity.class));
                } catch (Exception e) {
                    e.printStackTrace();
                    iRequest.request(null);
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });
    }

    @Override
    public void getRestDaShangWeiBa(final IRequest<DaShangRest> iRequest) {
        RequestParams params = new RequestParams();
        AddClient
                .get("http://bbs.chinapet.com/plugin.php?id=leepet_thread:api&action=topicadmin&op=rategetday",
                        params, new AsyncHttpResponseHandler() {
                            @Override
                            public void onSuccess(int statusCode, String content) {
                                super.onSuccess(statusCode, content);
                                try {
                                    iRequest.request(JSON.parseObject(content, DaShangRest.class));
                                } catch (Exception e) {
                                    e.printStackTrace();
                                    iRequest.request(null);
                                }
                            }

                            @Override
                            public void onFailure(Throwable error, String content) {
                                super.onFailure(error, content);
                                iRequest.request(null);
                            }
                        });
    }

    @Override
    public void getDaShangRecord(String tid, String pid, int page, int pagesize,
            final IRequest<DaShangRecord> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_TID, tid);
        params.add(PARAM_PID, pid);
        params.add(PARAM_PAGE, String.valueOf(page));
        params.add(PARAM_PAGESIZE, String.valueOf(pagesize));
        AddClient.get("http://bbs.chinapet.com/plugin.php?id=leepet_thread:api&action=viewratings",
                params, new AsyncHttpResponseHandler() {
                    @Override
                    public void onSuccess(int statusCode, String content) {
                        super.onSuccess(statusCode, content);
                        try {
                            iRequest.request(JSON.parseObject(content, DaShangRecord.class));
                        } catch (Exception e) {
                            e.printStackTrace();
                            iRequest.request(null);
                        }
                    }

                    @Override
                    public void onFailure(Throwable error, String content) {
                        super.onFailure(error, content);
                        iRequest.request(null);
                    }
                });


    }

    @Override
    public void getShareRecordInfo(String tid, int page, int pagesize,
            final IRequest<ShareRecordInfo> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_TID, tid);
        params.add(PARAM_PAGE, String.valueOf(page));
        params.add(PARAM_PAGESIZE, String.valueOf(pagesize));
        AddClient
                .get("http://bbs.chinapet.com/plugin.php?id=leepet_thread:api&action=sharelog&come=threadshow",
                        params, new AsyncHttpResponseHandler() {
                            @Override
                            public void onSuccess(int statusCode, String content) {
                                super.onSuccess(statusCode, content);
                                try {
                                    iRequest.request(JSON.parseObject(content,
                                            ShareRecordInfo.class));
                                } catch (Exception e) {
                                    e.printStackTrace();
                                    iRequest.request(null);
                                }
                            }

                            @Override
                            public void onFailure(Throwable error, String content) {
                                super.onFailure(error, content);
                                iRequest.request(null);
                            }
                        });


    }

    @Override
    public void getDianZanListData(String actid, int page, int pagesize,
            final IRequest<DianZanListData> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_ACTID, actid);
        params.add(PARAM_PAGE, String.valueOf(page));
        params.add(PARAM_PAGESIZE, String.valueOf(pagesize));
        AddClient.get(
                "http://bbs.chinapet.com/plugin.php?id=leepet_thread:api&action=shaituranking",
                params, new AsyncHttpResponseHandler() {
                    @Override
                    public void onSuccess(int statusCode, String content) {
                        super.onSuccess(statusCode, content);
                        try {
                            iRequest.request(JSON.parseObject(content, DianZanListData.class));
                        } catch (Exception e) {
                            e.printStackTrace();
                            iRequest.request(null);
                        }
                    }

                    @Override
                    public void onFailure(Throwable error, String content) {
                        super.onFailure(error, content);
                        iRequest.request(null);
                    }
                });
    }

    @Override
    public void getReYiListData(String actid, int page, int pagesize,
            final IRequest<ReYiListData> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_ACTID, actid);
        params.add(PARAM_PAGE, String.valueOf(page));
        params.add(PARAM_PAGESIZE, String.valueOf(pagesize));
        AddClient.get(
                "http://bbs.chinapet.com/plugin.php?id=leepet_thread:api&action=shaiturankbyreply",
                params, new AsyncHttpResponseHandler() {
                    @Override
                    public void onSuccess(int statusCode, String content) {
                        super.onSuccess(statusCode, content);
                        try {
                            iRequest.request(JSON.parseObject(content, ReYiListData.class));
                        } catch (Exception e) {
                            e.printStackTrace();
                            iRequest.request(null);
                        }
                    }

                    @Override
                    public void onFailure(Throwable error, String content) {
                        super.onFailure(error, content);
                        iRequest.request(null);
                    }
                });
    }

    @Override
    public void getChangeSex(String sex, final IRequest<BaseEntity> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_SEX, sex);
        AddClient
                .get("http://bbs.chinapet.com/plugin.php?id=leepet_thread:api&action=updateuserareaandsex",
                        params, new AsyncHttpResponseHandler() {
                            @Override
                            public void onSuccess(int statusCode, String content) {
                                super.onSuccess(statusCode, content);
                                try {
                                    iRequest.request(JSON.parseObject(content, BaseEntity.class));
                                } catch (Exception e) {
                                    e.printStackTrace();
                                    iRequest.request(null);
                                }
                            }

                            @Override
                            public void onFailure(Throwable error, String content) {
                                super.onFailure(error, content);
                                iRequest.request(null);
                            }
                        });
    }

    @Override
    public void getPostByUser(String keyword, final IRequest<SplashPictureBean> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_KEYWORD, keyword);
        AddClient
                .get("http://bbs.chinapet.com/plugin.php?id=leepet_thread:api&action=searchbyuserortitle",
                        params, new AsyncHttpResponseHandler() {
                            @Override
                            public void onSuccess(int statusCode, String content) {
                                super.onSuccess(statusCode, content);
                                try {
                                    iRequest.request(JSON.parseObject(content,
                                            SplashPictureBean.class));
                                } catch (Exception e) {
                                    e.printStackTrace();
                                    iRequest.request(null);
                                }
                            }

                            @Override
                            public void onFailure(Throwable error, String content) {
                                super.onFailure(error, content);
                                iRequest.request(null);
                            }
                        });
    }

    @Override
    public void getChangeArea(String province, String city, String area,
            final IRequest<BaseEntity> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_PROVINCE, province);
        params.add(PARAM_CITY, city);
        params.add(PARAM_AREA, area);
        AddClient
                .get("http://bbs.chinapet.com/plugin.php?id=leepet_thread:api&action=updateuserareaandsex",
                        params, new AsyncHttpResponseHandler() {
                            @Override
                            public void onSuccess(int statusCode, String content) {
                                super.onSuccess(statusCode, content);
                                try {
                                    iRequest.request(JSON.parseObject(content, BaseEntity.class));
                                } catch (Exception e) {
                                    e.printStackTrace();
                                    iRequest.request(null);
                                }
                            }

                            @Override
                            public void onFailure(Throwable error, String content) {
                                super.onFailure(error, content);
                                iRequest.request(null);
                            }
                        });
    }

    @Override
    public void getNearLocationInfos(int pageNum, int pageSize, String query, String location,
            final IRequest<List<Locations>> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_BAIDU_AK, "AsC2qIhSG6W3ATuFZaZ2lG6C");
        params.add(PARAM_BAIDU_OUTPUT, "json");// 指定输入格式为json
        params.add(PARAM_BAIDU_QUERY, query);// 查询关键字
        params.add(PARAM_BAIDU_SCOPE, "1");// 查询作用域默认为1
        params.add(PARAM_BAIDU_LOCATION, location);
        params.add(PARAM_BAIDU_RADIUS, "2000");// 查询范围半径
        params.add(PARAM_PAGE, String.valueOf(pageNum));
        params.add(PARAM_PAGESIZE, String.valueOf(pageSize));
        AddClient.get("http://api.map.baidu.com/place/v2/search", params,
                new AsyncHttpResponseHandler() {
                    @Override
                    public void onSuccess(int statusCode, String content) {
                        super.onSuccess(statusCode, content);
                        try {
                            iRequest.request(JSON.parseArray(JSON.parseObject(content)
                                    .getJSONArray("results").toJSONString(), Locations.class));
                        } catch (Exception e) {
                            e.printStackTrace();
                            iRequest.request(null);
                        }
                    }

                    @Override
                    public void onFailure(Throwable error, String content) {
                        super.onFailure(error, content);
                        iRequest.request(null);
                    }
                });
    }

    @Override
    public void getSearchCollection(String keyword, final IRequest<List<Message>> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_KEYWORD, keyword);
        AddClient.get(BASEURL + ACTION_SEARCHCOLLECTION, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                try {
                    iRequest.request(JSON.parseArray(JSON.parseObject(content)
                            .getJSONArray("array").toJSONString(), Message.class));
                } catch (Exception e) {
                    e.printStackTrace();
                    iRequest.request(null);
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });
    }

    @Override
    public void searchMyAttention(String keyword, final IRequest<Fans> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_KEYWORD, keyword);
        params.add(PARAM_FLAG, "0");
        AddClient.get(BASEURL + ACTION_SEARCHMYATTENTION, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                try {
                    iRequest.request(JSON.parseObject(content, Fans.class));
                } catch (Exception e) {
                    e.printStackTrace();
                    iRequest.request(null);
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });
    }

    @Override
    public void searchMyFans(String keyword, final IRequest<Fans> iRequest) {
        RequestParams params = new RequestParams();
        params.add(PARAM_KEYWORD, keyword);
        params.add(PARAM_FLAG, "1");
        AddClient.get(BASEURL + ACTION_SEARCHMYATTENTION, params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, String content) {
                super.onSuccess(statusCode, content);
                try {
                    iRequest.request(JSON.parseObject(content, Fans.class));
                } catch (Exception e) {
                    e.printStackTrace();
                    iRequest.request(null);
                }
            }

            @Override
            public void onFailure(Throwable error, String content) {
                super.onFailure(error, content);
                iRequest.request(null);
            }
        });
    }


}
